{ "id": "98882", "key": "TIMOB-10350", "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": "13870", "description": "", "name": "Sprint 2012-16 API", "archived": true, "released": true, "releaseDate": "2012-08-13" }, { "id": "14096", "description": "Release 2.1.2", "name": "Release 2.1.2", "archived": true, "released": true, "releaseDate": "2012-08-31" }, { "id": "13505", "description": "Release 3.0.0", "name": "Release 3.0.0", "archived": true, "released": true, "releaseDate": "2012-12-14" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-08-10T14:25:12.000+0000", "created": "2012-08-08T12:16:08.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "api", "module_xml", "parity", "qe-review", "qe-testadded" ], "versions": [ { "id": "13572", "description": "Release 2.1.1", "name": "Release 2.1.1", "archived": true, "released": true, "releaseDate": "2012-07-31" } ], "issuelinks": [ { "id": "19751", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "98507", "key": "MOD-845", "fields": { "summary": "OData : Android - The update and delete operations are failing on Android", "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 } } } } ], "assignee": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-12-10T06:02:14.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": "10202", "name": "Android", "description": "Android Platform" } ], "description": "If the URL of an HTTP request contains uppercase \"HTTP\" or \"HTTPS\" as the scheme then the request will fail badly.\r\n\r\nThe error is reproducible with the following simple example code:\r\n{code}\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload: function () {\r\n Ti.API.info(\"SUCCESS\" + this.responseText);\r\n },\r\n onerror: function (evt) {\r\n Ti.API.error(\"ERROR:\" + this.responseText);\r\n }\r\n });\r\n xhr.open('GET', \"HTTP://www.appcelerator.com:80\");\r\n xhr.send({});\r\n}\r\n{code}\r\n\r\nThe attached log file shows the output of the send operation. Note that I have enabled DBG in the code as well as added code to output the response.\r\n\r\nLine 20 in the log: You can see the 'GET' request with an uppercase \"HTTP\" in the url\r\nLine 23 in the log: You can see the 1st side-effect of the bad parse result -- it can't locate the port string\r\nLine 37 in the log: You can see what it thinks it needs to invoke\r\nLine 66 in the log: The start of the responseText that is actually received -- it contains bogus javascript code\r\n\r\nI believe that this is all caused by the code in TiHTTPClient.java not properly handling the uppercase HTTP scheme. Around line 768 in TiHTTPCLient.java is the following code:\r\n{code}\r\n\t\t// if the url is not prepended with either http or \r\n\t\t// https, then default to http and prepend the protocol\r\n\t\t// to the url\r\n\t\tif (!url.startsWith(\"http://\") && !url.startsWith(\"https://\")) {\r\n\t\t\turl = \"http://\" + url;\r\n\t\t}\r\n{code}\r\n\r\nThe result is that if the scheme is uppercase then the resulting URL that gets processed is \"http://HTTP://...\" and this throws the whole process off.\r\n\r\nAccording to the IETF (http://www.ietf.org/rfc/rfc1738.txt):\r\n{quote}\r\nFor resiliency, programs\r\n interpreting URLs should treat upper case letters as equivalent to\r\n lower case in scheme names (e.g., allow \"HTTP\" as well as \"http\").\r\n{quote}\r\n\r\nNote that this works fine on iOS.\r\n\r\nWorkaround for anyone running into this problem. Prior to calling 'open' on the http client object, replace the uppercase scheme using something like the following code:\r\n\r\n url = url.replace(/^HTTP:/,\"http:\");\r\n url = url.replace(/^HTTPS:/,\"https:\");\r\n", "attachment": [ { "id": "30359", "filename": "HTTP_error.log", "author": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "created": "2012-08-08T12:16:08.000+0000", "size": 23217, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: Uppercase HTTP in url causes failure", "creator": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "jenglish", "key": "jenglish", "displayName": "Jeff English", "active": true, "timeZone": "America/Chicago" }, "environment": "Titanium SDK 2.1.1.GA", "comment": { "comments": [ { "id": "213871", "author": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR https://github.com/appcelerator/titanium_mobile/pull/2708", "updateAuthor": { "name": "pwang", "key": "pwang", "displayName": "Ping Wang", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-10T14:25:02.000+0000", "updated": "2012-08-10T14:25:02.000+0000" }, { "id": "214428", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Fixed on 2_1_X by https://github.com/appcelerator/titanium_mobile/pull/2732", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2012-08-14T14:14:53.000+0000", "updated": "2012-08-14T14:14:53.000+0000" }, { "id": "214602", "author": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Closing as fixed.\r\nTested and verified on:\r\nTitanium Studio, build: 2.1.1.201208091713\r\nTitanium SDK, build: 2.1.2.v20120815081613\r\nDevices: Nexus 7 tab (4.1)", "updateAuthor": { "name": "tsmolich", "key": "tsmolich", "displayName": "Tamila Smolich", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2012-08-15T11:39:20.000+0000", "updated": "2012-08-15T11:39:20.000+0000" }, { "id": "283467", "author": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Anvil testcase PR https://github.com/appcelerator/titanium_mobile/pull/5039\n", "updateAuthor": { "name": "shameerj", "key": "shameerj", "displayName": "Shameer Jan", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-12-10T06:02:14.000+0000", "updated": "2013-12-10T06:02:14.000+0000" } ], "maxResults": 4, "total": 4, "startAt": 0 } } }