{ "id": "165373", "key": "TIMOB-24329", "fields": { "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false }, "project": { "id": "10153", "key": "TIMOB", "name": "Titanium SDK/CLI", "projectCategory": { "id": "10100", "description": "Titanium and related SDKs used in application development", "name": "Client" } }, "fixVersions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-02-09T14:22:32.000+0000", "created": "2017-01-19T13:44:51.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios", "qe-6.1.0", "regression" ], "versions": [ { "id": "17608", "name": "Release 6.1.0", "archived": false, "released": true, "releaseDate": "2017-05-26" } ], "issuelinks": [ { "id": "54272", "type": { "id": "10122", "name": "Gantt: start-finish", "inward": "is triggered by", "outward": "is triggering" }, "outwardIssue": { "id": "165945", "key": "TIMOB-24397", "fields": { "summary": "iOS: WebView - load a webpage with request headers", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "priority": { "name": "Critical", "id": "1" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "updated": "2017-02-15T13:26:01.000+0000", "status": { "description": "The issue is considered finished, the resolution is correct. Issues which are closed can be reopened.", "name": "Closed", "id": "6", "statusCategory": { "id": 3, "key": "done", "colorName": "green", "name": "Done" } }, "components": [ { "id": "10206", "name": "iOS", "description": "iOS Platform" } ], "description": "*Problem*\r\nSetting additional request headers disallows POST form requests to the same page. The 'load' event is not fired.\r\n\r\n_actual behavior_\r\n# click on 'open local page'\r\n# in the log is shown 'beforeload' and 'load' event\r\n# click on Submit button\r\n# in the log is shown 'beforeload'\r\n\r\n_expected behavior_\r\n# click on 'open local page'\r\n# in the log is shown 'beforeload' and 'load' event\r\n# click on Submit button\r\n# in the log is shown 'beforeload' and 'load' event\r\n\r\n*Test case*\r\nfile index.js\r\n{noformat}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:'white'\r\n});\r\n \r\nvar buttonGoogle = Ti.UI.createButton({\r\n title:'Open local page',\r\n top:'20%',\r\n height:'30%',\r\n left:'10%',\r\n right:'10%'\r\n});\r\n \r\nbuttonGoogle.addEventListener('click', function(){\r\n Ti.Network.removeAllHTTPCookies( );\r\n var webView = Ti.UI.createWebView();\r\n \r\n webView.setBasicAuthentication(\"username\", \"password\");\r\n var requestHeaders = {\r\n \"Accept-Language\": \"en\",\r\n \"X-Agent\" : \"Mobile\"\r\n };\r\n webView.setRequestHeaders(requestHeaders);\r\n \r\n webView.addEventListener('load', function(){\r\n Ti.API.info('load: ' + webView.url);\r\n });\r\n \r\n webView.addEventListener('beforeload', function(){\r\n Ti.API.info('beforeload: ' + webView.url);\r\n });\r\n \r\n webView.addEventListener('error', function(){\r\n Ti.API.info('error: ' + webView.url);\r\n });\r\n \r\n win.add(webView);\r\n \r\n var button = Ti.UI.createButton({\r\n title:'Close',\r\n right:0,\r\n bottom:0,\r\n height:'10%',\r\n width:'20%'\r\n });\r\n \r\n button.addEventListener('click', function(){\r\n win.remove(webView);\r\n });\r\n \r\n webView.add(button);\r\n var url = \"web/index.html\";\r\n webView.setUrl(url);\r\n});\r\n \r\nwin.add(buttonGoogle);\r\n \r\nwin.open();\r\n{noformat}\r\n\r\nfile app/assets/web/index.html\r\n\r\n{noformat}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\r\n\r\n{noformat}\r\n\r\n*Log*\r\n_actual behavior_\r\n\r\n{noformat}\r\n[INFO] : beforeload: web/index.html\r\n[INFO] : load: web/index.html\r\n[INFO] : beforeload: web/index.html\r\n{noformat}\r\n\r\n_expected behavior_\r\n{noformat}\r\n[INFO] : beforeload: web/index.html\r\n[INFO] : load: web/index.html\r\n[INFO] : beforeload: web/index.html\r\n[INFO] : load: web/index.html\r\n{noformat}", "attachment": [ { "id": "61288", "filename": "index.html", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T13:42:06.000+0000", "size": 305, "mimeType": "text/html" }, { "id": "61290", "filename": "index.js", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T14:18:15.000+0000", "size": 1296, "mimeType": "text/javascript" } ], "flagged": false, "summary": "iOS: setting additional request header disallows POST form requests", "creator": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Titanium SDK version: 6.1.0.v20170118081704\r\nJavascript Engine: V8\r\nPlatform & version: iOS\r\nDevice Details: iOS simulator iPhone 5s 10.2 \r\nHost Operating System: Mac OS X 10.12.2 \r\nTitanium Studio version: 4.8.1.201612050850", "closedSprints": [ { "id": 796, "state": "closed", "name": "2017 Sprint 02 SDK", "startDate": "2017-01-15T00:00:41.845Z", "endDate": "2017-01-29T00:00:00.000Z", "completeDate": "2017-01-30T21:10:44.640Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "404850", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hey Chirs (you should change your username to have something linkable :-),\r\n\r\nI see you tested with master (6.1.0), did this not happen in earlier versions of the SDK? If not, in which one did it work? I have a suspicion.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T13:52:11.000+0000", "updated": "2017-01-19T14:21:54.000+0000" }, { "id": "404853", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "Hi Hans\r\n\r\nThe additional request header setting is new in Ti SDK 6.1.0. I am using request headers and catch load and beforeload events. The issue only appears with additional request headers. I have already a solution for this. Give me a second to create a pull request.\r\n\r\nTo your questions \"did this not happen in earlier versions of the SDK?\"\r\nNo, because of the new additional request header feature.", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T14:24:07.000+0000", "updated": "2017-01-19T14:24:07.000+0000" }, { "id": "404854", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Gotcha! I was just able to reproduce this issue an moved it to Engineering for further investigation. Thank you! \r\n\r\n*EDIT*: What I observed so far is, that the headers are different from loading the native webview request and the html-based request.\r\n\r\n- webview-request-headers: Upgrade-Insecure-Requests, X-Titanium-Local-Id, Authorization\r\n- html-submit-request-headers: Origin, Content-Type\r\n\r\nSo after adding your 2 request headers, they are added to the list. For some reason, iOS then decides to not allow the request anymore. This will require more investigation.\r\n\r\n*EDIT 2*: Fixed it, the issue was that there is an internal flag that checks for the URL status. This needs to be reset before loading the updated request with the new headers. The fix is ready and will come asap.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T14:25:08.000+0000", "updated": "2017-01-19T14:39:22.000+0000" }, { "id": "404861", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "-I could see that the problem happens also on Android.-", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T14:54:55.000+0000", "updated": "2017-01-19T15:33:55.000+0000" }, { "id": "404864", "author": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "body": "Mhh, on Android we only pass it to the native methods, so if it doesn't fire from there, we can't really intercept it.", "updateAuthor": { "name": "hknoechel", "key": "hansknoechel", "displayName": "Hans Knöchel", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T15:02:56.000+0000", "updated": "2017-01-19T15:02:56.000+0000" }, { "id": "404865", "author": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "body": "I tried it with a different test setup and it works on Android. So my first try and guess was wrong. Here are the test files:\r\n\r\n*index.js*\r\n{noformat}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor:'white'\r\n});\r\n \r\nvar buttonGoogle = Ti.UI.createButton({\r\n title:'Open local page',\r\n top:'200',\r\n height:Ti.UI.SIZE,\r\n left:'30',\r\n});\r\n \r\nbuttonGoogle.addEventListener('click', function() {\r\n \r\n \r\n var ldf = Ti.Platform.displayCaps.logicalDensityFactor;\r\n var webView = Ti.UI.createWebView({\r\n height: Math.floor(Ti.Platform.displayCaps.platformHeight / ldf),\r\n width: Math.floor(Ti.Platform.displayCaps.platformWidth / ldf),\r\n backgroundColor: \"white\",\r\n });\r\n \r\n webView.setBasicAuthentication(\"username\", \"password\");\r\n var requestHeaders = {\r\n \"Accept-Language\": \"en\",\r\n \"X-Agent\" : \"Mobile\"\r\n };\r\n webView.setRequestHeaders(requestHeaders);\r\n \r\n webView.addEventListener('load', function(){\r\n Ti.API.info('load: ' + webView.url);\r\n });\r\n \r\n webView.addEventListener('beforeload', function(){\r\n Ti.API.info('beforeload: ' + webView.url);\r\n });\r\n \r\n webView.addEventListener('error', function(){\r\n Ti.API.info('error: ' + webView.url);\r\n });\r\n \r\n win.add(webView);\r\n \r\n var button = Ti.UI.createButton({\r\n title:'Close',\r\n top:25,\r\n bottom:0,\r\n height:Ti.UI.SIZE,\r\n width:100\r\n });\r\n \r\n button.addEventListener('click', function(){\r\n win.remove(webView);\r\n });\r\n \r\n webView.add(button);\r\n var url = \"/web/index.html\";\r\n webView.setUrl(url);\r\n});\r\n \r\nwin.add(buttonGoogle);\r\n \r\nwin.open();\r\n{noformat}\r\n\r\n*assets/web/index.html*\r\n{noformat}\r\n\r\n\t\r\n\t\t\r\n\t\r\n\t\r\n\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t\t\r\n\t\t
\r\n\t\t\t
\r\n\t\t\t\t\r\n\t\t\t\t\r\n\t\t\t
\r\n\t\t\t
\r\n\t\r\n\r\n{noformat}", "updateAuthor": { "name": "chris35", "key": "chris35", "displayName": "Christoph Eck", "active": true, "timeZone": "Europe/Berlin" }, "created": "2017-01-19T15:33:33.000+0000", "updated": "2017-01-19T15:33:33.000+0000" }, { "id": "407091", "author": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "body": "Verified as fixed, ran an app with the provided demo code firstly with an affected 6.1.X build to confirm that the error is reproducible in my environment. Subsequently built the app with a 6.1.X build containing PR #8765 and was able to receive the expected behaviour. Tested with:\r\n\r\niPhone 7 (10.2) Device & Simulator\r\niPhone 6S (9.3) Simulator\r\niPhone 5S (9.3) Device\r\nMac OS Sierra (10.12.2)\r\nTi SDK: 6.1.0.v20170213134957\r\nAppc Studio: 4.8.1.201701192045\r\nAppc NPM: 4.2.9-1\r\nApp CLI: 6.1.0\r\nXcode 8.2.1\r\nNode v4.4.7\r\n\r\n*Closing ticket.*\r\n\r\n", "updateAuthor": { "name": "htbryant", "key": "htbryant", "displayName": "Harry Bryant", "active": true, "timeZone": "Europe/London" }, "created": "2017-02-15T13:25:37.000+0000", "updated": "2017-02-15T13:25:37.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }