{ "id": "134598", "key": "TIMOB-17584", "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": "16586", "description": "Release 3.4.2", "name": "Release 3.4.2", "archived": false, "released": true, "releaseDate": "2017-03-11" }, { "id": "16704", "description": "Release 3.5.0", "name": "Release 3.5.0", "archived": false, "released": true, "releaseDate": "2015-01-13" }, { "id": "16593", "description": "Release 4.0.0", "name": "Release 4.0.0", "archived": false, "released": true, "releaseDate": "2015-05-21" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2014-10-21T16:17:44.000+0000", "created": "2014-08-12T19:26:51.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "TCSupport", "module_network", "qe-manualtest" ], "versions": [ { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "40799", "type": { "id": "10001", "name": "Cloners", "inward": "is cloned into", "outward": "is cloned from" }, "inwardIssue": { "id": "135956", "key": "TIMOB-17585", "fields": { "summary": "Android: HTTPClient: Invalid Status Codes returned in 3.3.0.GA SDK", "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": "High", "id": "2" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } }, { "id": "56987", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "172601", "key": "TIMOB-26549", "fields": { "summary": "Windows: HTTPClient: Invalid Status Codes returned", "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": "Medium", "id": "3" }, "issuetype": { "id": "1", "description": "A problem which impairs or prevents the functions of the product.", "name": "Bug", "subtask": false } } } } ], "assignee": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2018-11-13T12:03:35.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": "h4. Problem Description\r\nWhen a GET request should be returning a status of \"301\" or \"302\", I have the 3.3.0 GA SDK returning a \"200\".\r\n\r\nSwitching back to the 3.2.3 GA SDK fixes the problem.\r\n\r\nWhen we have tested using the following code, the status returned is \"302\" in 3.3.0.GA and \"301\" in 3.2.3.GA.\r\n \r\nh4. Steps to reproduce \r\n a) Create a simple project.\r\n b) Update this code in app.js:\r\n\r\n{code}var xhr = Titanium.Network.createHTTPClient();\r\nxhr.autoRedirect = false;\r\nxhr.allResponseHeaders = true;\r\n\r\n// what to do if it loads\r\nxhr.onload = function(e) {\r\n\r\n\tTi.API.log('Status = ' + this.getStatus());\r\n\r\n\tif (this.getStatus() == 301) {\r\n\t\tTi.API.log('Redirect to ' + this.getResponseHeader('location'));\r\n\t} else {\r\n\t\tTi.API.log('This should have returned a 301 not a 200');\r\n\t}\r\n};\r\n\r\nxhr.open('GET', 'http://google.co.nz');\r\nxhr.send();{code}\r\n\r\n c) Run this with testing environment\r\n \r\n\r\n\r\nh4. Test results\r\n\r\nIn Titanium SDK: 3.3.0.GA \r\n\r\n[DEBUG]: Application booted in 125.191987 ms\r\n[INFO] : Status = 302\r\n[INFO] : This should have returned a 301 not a 200\r\n\r\nIn Titanium SDK: 3.2.3.GA \r\n\r\n[DEBUG]: Application booted in 110.395968 ms\r\n[INFO] : Status = 301\r\n[INFO] : Redirect to http://www.google.co.nz/\r\n", "attachment": [ { "id": "51022", "filename": "Redirectinfo.png", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-09-05T23:34:33.000+0000", "size": 12377, "mimeType": "image/png" } ], "flagged": false, "summary": "iOS: HTTPClient: AutoRedirect = false returns 200 status code, not 301/302", "creator": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "subtasks": [], "reporter": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "environment": " Titanium SDK: 3.3.0.GA and 3.2.3.GA\r\n Titanium CLI: 3.3.0\r\n OS X Version: 10.9.3\r\n iOS Simulator: 7.1\r\n Xcode Version: 5.1.1\r\n Android API Level: 17 and 19\r\n Note: This is happengin in iOS8 as well. \r\n", "closedSprints": [ { "id": 230, "state": "closed", "name": "2014 Sprint 21 SDK", "startDate": "2014-10-13T22:00:57.270Z", "endDate": "2014-10-25T00:00:00.000Z", "completeDate": "2014-10-27T16:33:06.432Z", "originBoardId": 114 }, { "id": 220, "state": "closed", "name": "2014 Sprint 20 SDK", "startDate": "2014-09-29T22:32:25.224Z", "endDate": "2014-10-13T18:25:00.000Z", "completeDate": "2014-10-13T18:25:45.560Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "318256", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Some sample code:\r\n\r\n{code:javascript}\r\nvar xhr = Titanium.Network.createHTTPClient();\r\nxhr.autoRedirect = false;\r\nxhr.allResponseHeaders = true;\r\n \r\n// what to do if it loads\r\nxhr.onload = function (e) {\r\n \r\n Ti.API.log('Status = ' + this.getStatus());\r\n \r\n if (this.getStatus() == 301) {\r\n Ti.API.log('Redirect to ' + this.getResponseHeader('location'));\r\n } else {\r\n Ti.API.log('This should have returned a 301 not a 200');\r\n }\r\n};\r\n \r\nxhr.open('GET', 'http://google.co.nz');\r\nxhr.send();\r\n{code}\r\n\r\nOn OS X Yosemite, with Xcode 5.1.1, iOS Simulator 7.1, and SDK 3.3.0 this returns a response of \"200\". Incorrect.\r\n\r\nOn OS X Yosemite, with Xcode 5.1.1, iOS Simulator 7.1, and SDK 3.2.3 this returns a response of \"301\". Correct.\r\n\r\nOn my iPhone running iOS 8 beta 5 I can confirm that SDK 3.3.0 was also returning a \"200\", and switching back to 3.2.3 fixed the issue to return a \"301\" again.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-08-12T19:29:11.000+0000", "updated": "2014-08-12T19:41:28.000+0000" }, { "id": "318257", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Possibly related to TIMOB-15871.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-08-12T19:30:55.000+0000", "updated": "2014-08-12T19:31:03.000+0000" }, { "id": "318262", "author": { "name": "icaiza", "key": "icaiza", "displayName": "icaiza", "active": true, "timeZone": "America/Bogota" }, "body": "hello, I commented that I could give you a solution but not the right as it is impossible for me to handle the error. My url is for session start and redirects the browser along with a session cookie.\r\n\r\nvar xhr = Ti.Network.createHTTPClient({timeout: 8000, autoRedirect: false}); //\r\nxhr.onreadystatechange = function() {\r\n\tif(this.readyState == 3){\r\n\tvar cookieArray = xhr.getResponseHeader(\"Set-Cookie\"), //read cookie\r\n\t\tlocationArray = xhr.getResponseHeader(\"Location\")\t// read location redirect\r\n\t}\r\n\t//IF NULL cookiearray error or session no valid\r\n};\r\nxhr.open(\"POST\", \"http://myurl.com/login\");\r\nxhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded; charset=utf-8');\r\nxhr.send({\r\n\t\"var1\": \"value1\", \"var2\": \"value2\"\r\n});\r\n\r\nBy the way for iOs simply establish autoRedirect: false", "updateAuthor": { "name": "icaiza", "key": "icaiza", "displayName": "icaiza", "active": true, "timeZone": "America/Bogota" }, "created": "2014-08-12T19:55:12.000+0000", "updated": "2014-08-12T20:14:15.000+0000" }, { "id": "318268", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "[~mdelmarter] I'm looking at the source code and we're returning the status code that native implementation is giving us. \r\nhttps://github.com/appcelerator/APSHTTPClient/blob/master/APSHTTPClient/APSHTTPResponse.m#L25\r\nI tested the URL you provided and it does return a redirect status code, 301. This is making the http client redirect to a different URL, http://www.google.co.nz/. If you still want to go to that URL, add the [autoRedirect|http://docs.appcelerator.com/titanium/latest/#!/api/Titanium.Network.HTTPClient-property-autoRedirect] property to the request to false", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-08-12T20:09:57.000+0000", "updated": "2014-08-12T20:09:57.000+0000" }, { "id": "318272", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Hi Pedro,\r\n\r\nDid you see my sample code above? autoRedirect is already set to false.\r\n\r\nAs mentioned, running the exact code I submitted, and in the exact environments I submitted, the status returned is \"200\" in 3.3.0 and \"301\" in 3.2.3.\r\n\r\nI am not sure how else to describe the issue. Maybe it is Yosemite, or iOS 8 beta 5 that is key to seeing this issue? But my bug report is accurate for my build environment, and on my iPhone running iOS 8 beta 5.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-08-12T20:21:10.000+0000", "updated": "2014-08-12T20:21:10.000+0000" }, { "id": "318275", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "You're right, my mistake. I just ran it with 3.3.0.GA and this is what I got.\r\n{code}\r\n[DEBUG] Application booted in 164.345980 ms\r\n[INFO] Status = 302\r\n[INFO] This should have returned a 301 not a 200\r\n{code}\r\nI'll give it another shot with iOS 8", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-08-12T20:24:54.000+0000", "updated": "2014-08-12T20:24:54.000+0000" }, { "id": "318277", "author": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Got the same thing with iOS 8 and Xcode 6-Beta 4\r\n{code}\r\n[DEBUG] Application booted in 247.303009 ms\r\n[INFO] Status = 302\r\n[INFO] This should have returned a 301 not a 200\r\n{code}", "updateAuthor": { "name": "penrique", "key": "penrique", "displayName": "Pedro Enrique", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-08-12T20:29:14.000+0000", "updated": "2014-08-12T20:29:14.000+0000" }, { "id": "318325", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Hi Pedro - it still intrigues me that you are getting a \"302\" instead of a \"200\" which I am getting on:\r\n\r\n* Yosemite + Xcode 5.5.1 + Simulator 7.1 + 3.3.0GA SDK. \r\n* Xcode 5.5.1 + iOS Beta 5 + 3.3.0GA SDK. \r\n\r\nThanks for looking into it though.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-08-12T22:32:23.000+0000", "updated": "2014-08-12T22:32:44.000+0000" }, { "id": "321251", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "I think we can establish that this problem is not reproducible on OS X Version: 10.9.3.\r\n\r\nAs mentioned in the initial bug report the problem was happening on Yosemite - which is OS X Version 10.10.\r\n\r\nAnd also on iOS 8 beta 5. Not iOS 7.1.\r\n\r\nAll the tests I see here to reproduce and try and fix this issue are not using the platforms initially reported on?\r\n\r\nMaybe the issue is isolated to these environments. Can anybody clarify with a test on these platforms? ", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-09-01T22:20:20.000+0000", "updated": "2014-09-01T22:21:53.000+0000" }, { "id": "321252", "author": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "body": "Hello [~mdelmarter]:\r\n\r\nIn order to move this bug from TC to TIMOB, we need to provide a testcase. The testcase was tested on Ti Mobile SDK 3.3.0.GA, that's the reason it's being shown here. \r\n\r\nBest Regards", "updateAuthor": { "name": "mpmiranda", "key": "mpmiranda", "displayName": "Mauro Parra-Miranda", "active": true, "timeZone": "America/Mexico_City" }, "created": "2014-09-01T22:40:57.000+0000", "updated": "2014-09-01T22:40:57.000+0000" }, { "id": "321385", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~emerriman] To find duplicate.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-09-02T18:27:07.000+0000", "updated": "2014-09-02T18:27:07.000+0000" }, { "id": "322160", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Ran the test code provided using the following environment:\r\n\r\nMac OSX 10.9.4\r\nAppcelerator Studio, build: 3.4.0.201409021758\r\nTitanium SDK build: 3.4.0.v20140903121714, 3.3.0.GA, 3.2.3.GA\r\nTitanium CLI, build: 3.4.0-beta, 3.3.0\r\nAlloy: 1.5.0-beta\r\nXcode6-Beta7, Xcode5.1.1\r\niOS Devices iPhone 5(8.0b5), iPhone 5(7.1.1)\r\n\r\nAs shown in the table below on both 3.4.0.v20140903121714 and 3.3.0.GA the status being shown is 200, this differs from 3.2.3.GA which gives us a 301. Using the Firefox webconsole to monitor this however I see that the website differs from all of these and gives a 302 status code followed by a 200 as shown in the attached screenshot\r\n\r\n|| ||Status Code||\r\n||3.4.0.v20140903121714| 200 |\r\n||3.3.0.GA| 200 |\r\n||3.2.3.GA| 301 |\r\n", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-09-05T22:40:10.000+0000", "updated": "2014-09-05T22:40:10.000+0000" }, { "id": "322172", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "@Ewan - I am so glad that somebody else has managed to confirm this issue.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-09-05T23:41:08.000+0000", "updated": "2014-09-05T23:41:08.000+0000" }, { "id": "324655", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Really hoping to get a hot patch for this soon - I cannot update to SDK 3.3.0 or 3.4.0 without this fix, and with iOS 8 out the door it is getting more urgent.", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-09-19T05:58:03.000+0000", "updated": "2014-09-19T05:58:03.000+0000" }, { "id": "324661", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "Out of curiosity is this bug fix/patch related?\r\nhttps://github.com/appcelerator/APSHTTPClient/pull/16\r\n\r\n", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-09-19T06:17:16.000+0000", "updated": "2014-09-19T06:17:16.000+0000" }, { "id": "328831", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "PR's merged\r\nAPSHTTPClient - https://github.com/appcelerator/APSHTTPClient/pull/17\r\nTitanium SDK\r\n\r\nmaster - https://github.com/appcelerator/titanium_mobile/pull/6230\r\n3_4_X - https://github.com/appcelerator/titanium_mobile/pull/6245", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-21T16:17:44.000+0000", "updated": "2014-10-21T16:26:37.000+0000" }, { "id": "328850", "author": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "body": "I can confirm that this fixes the issue. Thanks so much - you have no idea how happy it makes me to be able to use the 3.4.0 SDK in my app finally :)", "updateAuthor": { "name": "mdelmarter", "key": "mdelmarter", "displayName": "Matthew Delmarter", "active": true, "timeZone": "Pacific/Auckland" }, "created": "2014-10-21T17:17:12.000+0000", "updated": "2014-10-21T17:17:44.000+0000" }, { "id": "333686", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "body": "Verified fix on:\r\n\r\nMac OSX 10.10.1\r\nAppcelerator Studio, build: 3.4.1.201410281743\r\nTitanium SDK build: 3.5.0.v20141124155715, \r\nTitanium CLI, build: 3.4.1\r\nAlloy: 1.5.1\r\niPhone 6 Plus (8.1), iPhone 6 Simulator (8.2)\r\n\r\nUsing the test case provided ran on simulator and device the status code returned is 301 as expected.\r\n\r\nClosing ticket.", "updateAuthor": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-11-25T19:31:32.000+0000", "updated": "2014-11-25T19:31:32.000+0000" } ], "maxResults": 20, "total": 20, "startAt": 0 } } }