{ "id": "152895", "key": "TIMOB-19950", "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": "17072", "name": "Release 5.1.2", "archived": false, "released": true, "releaseDate": "2016-01-12" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2016-01-14T02:55:08.000+0000", "created": "2015-11-11T14:27:43.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "Community", "httpclient", "regression" ], "versions": [], "issuelinks": [], "assignee": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-21T20:44:27.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": "Making an HTTP request with basic auth that that results in a 401 response causes the same request to be repeated resulting in an endless loop of HTTP requests.\r\n\r\nNeither onload nor onerror callback is called. \r\n\r\nTest case: \r\n\r\n{code}\r\nvar url = \"http://httpbin.org/basic-auth/user/passwd\";\r\nvar client = Ti.Network.createHTTPClient({\r\n // function called when the response data is available\r\n onload : function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n // function called when an error occurs, including a timeout\r\n onerror : function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n username: \"test\",\r\n password: \"test\",\r\n timeout : 5000 // in milliseconds\r\n});\r\n// Prepare the connection.\r\nclient.open(\"GET\", url);\r\n// Send the request.\r\nclient.send();\r\n{code}\r\n\r\n\r\n", "attachment": [], "flagged": false, "summary": "iOS: HTTP requests with basic auth returning with 401 Unauthorised trigger endless repeated requests", "creator": { "name": "shodan_uk", "key": "shodan_uk", "displayName": "Terry Morgan", "active": true, "timeZone": "Europe/London" }, "subtasks": [], "reporter": { "name": "shodan_uk", "key": "shodan_uk", "displayName": "Terry Morgan", "active": true, "timeZone": "Europe/London" }, "environment": "* Ti SDK 5.0.2.GA and 5.1.0.v20151104190037 (earlier SDKs don't seem to be affected)\r\n* iOS 9.1 on device & simulator\r\n* Mac OSX 10.11.1\r\n* Node v0.10.38", "comment": { "comments": [ { "id": "370035", "author": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "body": "Hi ,\r\nI tested the issue you reported . I can reproduce it only iPhone devices but everything worked fine on simulators. I tested this using the 5.1.0.v20151021104424.\r\n\r\nThis is a valid issue.\r\n\r\n\r\n*Environment*\r\n{code}\r\nThu Nov 12 2015 12:19:29 GMT+0600 (BDT)\r\nOperating System\r\n Name = Mac OS X\r\n Version = 10.10.5\r\n Architecture = 64bit\r\n # CPUs = 4\r\n Memory = 8589934592\r\nNode.js\r\n Node.js Version = 0.10.37\r\n npm Version = 1.4.28\r\nTitanium CLI\r\n CLI Version = 5.0.5\r\nTitanium SDK\r\n SDK Version = 5.1.0.v20151021104424\r\n SDK Path = /Users/Library/Application Support/Titanium/mobilesdk/osx/5.1.0.v20151021104424.\r\n Target Platform = iphone\r\n{code}\r\n\r\nThanks", "updateAuthor": { "name": "aislam", "key": "aislam", "displayName": "Aminul Islam", "active": false, "timeZone": "Etc/GMT-6" }, "created": "2015-11-12T06:57:56.000+0000", "updated": "2015-11-12T17:48:25.000+0000" }, { "id": "370084", "author": { "name": "shodan_uk", "key": "shodan_uk", "displayName": "Terry Morgan", "active": true, "timeZone": "Europe/London" }, "body": "I've tested this against 2 different APIs with the same result. If you're not familiar with it, http://httpbin.org is a very useful resource for testing for specific API responses and it is one of the two APIs I have tested this against (as per my test case above).\r\n\r\nThis seems to be an issue specific to 401 responses so it's important you test against a real API that returns a valid \"401 Unauthorized\" response to reproduce this issue. I mention this as your test code appears to use a dummy url. You may have used a real API when you actually tested but I wanted to check that this was definitely the case.\r\n\r\nI also notice that you're not setting the username & password for HTTP basic auth correctly in your test case. As per the Ti does, the username & password need to be set on the XHR object before calling open(), as per my test case.\r\n\r\nhttp://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient-property-username\r\n\r\nFinally, it's important to either monitor the requests from the API end or use a proxy to monitor traffic as there will be no output whatsoever in the Titanium logs.\r\n\r\nWould you mind either confirming that your tests complies with the above or trying again to reproduce following the above guidelines?", "updateAuthor": { "name": "shodan_uk", "key": "shodan_uk", "displayName": "Terry Morgan", "active": true, "timeZone": "Europe/London" }, "created": "2015-11-12T12:39:58.000+0000", "updated": "2015-11-12T12:52:03.000+0000" }, { "id": "370086", "author": { "name": "chmiiller", "key": "chmiiller", "displayName": "Carlos Henrique Zinato", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Same here!\r\nBut only on real device (iPhone 5).\r\nEverything worked fine on simulators...that's super strange!\r\n\r\niOS 9.1\r\nSDK 5.0.2", "updateAuthor": { "name": "chmiiller", "key": "chmiiller", "displayName": "Carlos Henrique Zinato", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-11-12T13:35:52.000+0000", "updated": "2015-11-12T13:35:52.000+0000" }, { "id": "371110", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-23T07:59:53.000+0000", "updated": "2015-11-23T07:59:53.000+0000" }, { "id": "371161", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-11-23T16:01:53.000+0000", "updated": "2015-11-23T16:01:53.000+0000" }, { "id": "374500", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-01-14T02:55:08.000+0000", "updated": "2016-01-14T02:55:08.000+0000" }, { "id": "414384", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as fixed.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T20:44:27.000+0000", "updated": "2017-03-21T20:44:27.000+0000" } ], "maxResults": 7, "total": 7, "startAt": 0 } } }