{ "id": "115058", "key": "TIMOB-14012", "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": "15497", "description": "2013 Sprint 11 API", "name": "2013 Sprint 11 API", "archived": true, "released": true, "releaseDate": "2013-06-03" }, { "id": "15109", "description": "2013 Sprint 11", "name": "2013 Sprint 11", "archived": true, "released": true, "releaseDate": "2013-06-03" }, { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-05-29T18:43:51.000+0000", "created": "2013-05-28T22:28:26.000+0000", "priority": { "name": "Critical", "id": "1" }, "labels": [ "qe-3.1.1", "qe-testadded" ], "versions": [ { "id": "15478", "description": "Release 3.1.1", "name": "Release 3.1.1", "archived": true, "released": true, "releaseDate": "2013-06-17" } ], "issuelinks": [ { "id": "48972", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "151141", "key": "TIMOB-19505", "fields": { "summary": "Ti.Network.HTTPClient Default addition of Appcelerator User-Agent header can impact success of network calls", "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": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2015-09-13T07:08:30.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": "h5. Description:\r\nWhile verifying results from an XHR feature change, I noted that the user agent for iOS and Android were different. On Android, the user agent is null.\r\n\r\nHere are examples of the user agent info for iOS and android:\r\nh6. Android\r\n{ 'x-titanium-id': 'd67defe8-12dd-45ba-b8fd-1e915158ee1b', 'x-requested-with': 'XMLHttpRequest', 'user-agent': '', host: '172.16.83.53:8000', connection: 'Keep-Alive' }\r\n\r\nh6. iOS\r\n{ host: '127.0.0.1:8000', 'x-titanium-id': '589be76d-ff3d-42ff-baca-07f1363aced0', 'accept-encoding': 'gzip', 'user-agent': 'Appcelerator Titanium/3.1.1.v20130522190722 (iPhone Simulator/6.0; iPhone OS; en_US;)', connection: 'close', 'x-requested-with': 'XMLHttpRequest' }\r\n\r\n\r\nh5. Steps to reproduce:\r\n1) Download and run the attached \".js\" file with \"node testserver.js\"\r\n2) Install the following test code and run in simulator\r\n3) Press the send request button\r\n\r\nh6. Test code\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'white'\r\n});\r\n \r\nvar url = \"http://127.0.0.1:8000\";\r\n \r\nvar button = Ti.UI.createButton({\r\n title : 'Send request',\r\n top : 280,\r\n width : 240,\r\n height : 100\r\n});\r\n \r\nwin.add(button);\r\n \r\nbutton.addEventListener('click', function() {\r\n var client = Ti.Network.createHTTPClient({\r\n onload : function(e) {\r\n Ti.API.info(\"Received text: \" + this.responseText);\r\n alert('success');\r\n },\r\n onerror : function(e) {\r\n Ti.API.debug(e.error);\r\n alert('error');\r\n },\r\n timeout : 5000\r\n });\r\n \r\n client.open(\"GET\", url);\r\n// client.setRequestHeader('X-Titanium-Id', null);\r\n client.send();\r\n});\r\n \r\nwin.open();\r\n{code}\r\n\r\nh5. Result:\r\nAndroid user agent is null\r\n\r\nh5. Expected Result:\r\niOS and Android have parity with regards to user agent", "attachment": [ { "id": "39148", "filename": "testserver.js", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-28T22:28:26.000+0000", "size": 249, "mimeType": "application/x-javascript" } ], "flagged": false, "summary": "Android: Parity - XHR user agent is null on Android, populated on iOS", "creator": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "Mac OS 10.8.3\r\nSafari: 6.0.4\r\nXcode 4.6.2\r\nCLI: 3.1.1-alpha\r\ntitanium-code-processor: 1.0.1-alpha\r\nAlloy: 1.1.3-alpha\r\nAppcelerator Studio, build: 3.1.1.201305271814\r\nTitanium SDK version 3.1.1.v20130524180421", "comment": { "comments": [ { "id": "254441", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "From discussion, the ACS-pem inserter tries to find 'android' from user_agent, user_agent.match(/android/i). So the user-agent string needs to at least have that.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-28T23:09:22.000+0000", "updated": "2013-05-28T23:09:22.000+0000" }, { "id": "254460", "author": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Information that may be relevant:\n* NetworkModule.java, line 131, does a setProperty for \"userAgent\" of System.getProperties().getProperty(\"http.agent\") + \" Titanium/\" + TiApplication.getInstance().getTiBuildVersion()\n* TitaniumModule.java, line 69, has a hardwired \"getUserAgent\" that builds the same string as NetworkModule.java\n* TiHTTPClient.java, line 874, has setRequestHeader(\"User-Agent\", (String) proxy.getProperty(\"userAgent\"))\n\nNote, however, that neither userAgent property of NetworkModule nor TitaniumModule is ever transferred to TiHTTPClient, nor to other areas. In fact, the only other place userAgent is mentioned is in conjunction with Ti.UI.webView.\n\n", "updateAuthor": { "name": "blainhamon", "key": "blainhamon", "displayName": "Blain Hamon", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-29T00:32:03.000+0000", "updated": "2013-05-29T00:32:03.000+0000" }, { "id": "254587", "author": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "body": "PR pending\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4336 - master\r\nhttps://github.com/appcelerator/titanium_mobile/pull/4337 - 3_!_X", "updateAuthor": { "name": "srahim", "key": "srahim", "displayName": "Sabil Rahim", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-29T17:52:39.000+0000", "updated": "2013-05-29T17:52:39.000+0000" }, { "id": "254914", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "On device:\n { 'x-titanium-id': '557fb1a9-5ee6-421f-831c-31574bf5386f',\n 'x-requested-with': 'XMLHttpRequest',\n 'user-agent': 'Appcelerator Titanium/3.1.1 (SAMSUNG-SGH-I777; Android API Level: 10; en-US;)',\n host: '172.16.1.170:5678',\n connection: 'Keep-Alive' }\n\nCan't get the emulator running. Get the error:\n{code}\nE/TiHttpClient( 1414): (TiHttpClient-1) [4325,4325] HTTP Error (org.apache.http.conn.HttpHostConnectException): Connection to http://127.0.0.1:5678 refused\nE/TiHttpClient( 1414): org.apache.http.conn.HttpHostConnectException: Connection to http://127.0.0.1:5678 refused\nE/TiHttpClient( 1414): \tat org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:183)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.conn.AbstractPoolEntry.open(AbstractPoolEntry.java:164)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.conn.AbstractPooledConnAdapter.open(AbstractPooledConnAdapter.java:119)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.client.DefaultRequestDirector.execute(DefaultRequestDirector.java:360)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:555)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:653)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.client.AbstractHttpClient.execute(AbstractHttpClient.java:637)\nE/TiHttpClient( 1414): \tat ti.modules.titanium.network.TiHTTPClient$ClientRunnable.run(TiHTTPClient.java:1271)\nE/TiHttpClient( 1414): \tat java.lang.Thread.run(Thread.java:856)\nE/TiHttpClient( 1414): Caused by: java.net.ConnectException: failed to connect to /127.0.0.1 (port 5678) after 5000ms: isConnected failed: ECONNREFUSED (Connection refused)\nE/TiHttpClient( 1414): \tat libcore.io.IoBridge.isConnected(IoBridge.java:214)\nE/TiHttpClient( 1414): \tat libcore.io.IoBridge.connectErrno(IoBridge.java:152)\nE/TiHttpClient( 1414): \tat libcore.io.IoBridge.connect(IoBridge.java:112)\nE/TiHttpClient( 1414): \tat java.net.PlainSocketImpl.connect(PlainSocketImpl.java:192)\nE/TiHttpClient( 1414): \tat java.net.PlainSocketImpl.connect(PlainSocketImpl.java:459)\nE/TiHttpClient( 1414): \tat java.net.Socket.connect(Socket.java:842)\nE/TiHttpClient( 1414): \tat org.apache.http.conn.scheme.PlainSocketFactory.connectSocket(PlainSocketFactory.java:119)\nE/TiHttpClient( 1414): \tat org.apache.http.impl.conn.DefaultClientConnectionOperator.openConnection(DefaultClientConnectionOperator.java:144)\nE/TiHttpClient( 1414): \t... 8 more\nE/TiHttpClient( 1414): Caused by: libcore.io.ErrnoException: isConnected failed: ECONNREFUSED (Connection refused)\nE/TiHttpClient( 1414): \tat libcore.io.IoBridge.isConnected(IoBridge.java:201)\nE/TiHttpClient( 1414): \t... 15 more\nD/TiAPI ( 1414): Connection to http://127.0.0.1:5678 refused\nI/ALERT ( 1414): (KrollRuntimeThread) [45,4370] error\n{code}\n", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-30T18:44:21.000+0000", "updated": "2013-05-30T18:44:21.000+0000" }, { "id": "254996", "author": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "body": "A little IP and port tweaking and this functions as expected on emulator, Device, and packaged on device.\n\nExamples:\n\nEMULATOR:\n { 'x-titanium-id': '557fb1a9-5ee6-421f-831c-31574bf5386f',\n 'x-requested-with': 'XMLHttpRequest',\n 'user-agent': 'Appcelerator Titanium/3.1.1 (google_sdk; Android API Level: 15; en-US;)',\n host: '172.16.1.170:5678',\n connection: 'Keep-Alive' }\n\nDevice/packaged builds:\n\nRequest Headers: \n { 'x-titanium-id': '557fb1a9-5ee6-421f-831c-31574bf5386f',\n 'x-requested-with': 'XMLHttpRequest',\n 'user-agent': 'Appcelerator Titanium/3.1.1 (SAMSUNG-SGH-I337; Android API Level: 17; en-US;)',\n host: '172.16.1.170:5678',\n connection: 'Keep-Alive' }\nRequest Headers: \n { 'x-titanium-id': '557fb1a9-5ee6-421f-831c-31574bf5386f',\n 'x-requested-with': 'XMLHttpRequest',\n 'user-agent': 'Appcelerator Titanium/3.1.1 (SAMSUNG-SGH-I777; Android API Level: 10; en-US;)',\n host: '172.16.1.170:5678',\n connection: 'Keep-Alive' }\nRequest Headers: \n { 'x-titanium-id': '557fb1a9-5ee6-421f-831c-31574bf5386f',\n 'x-requested-with': 'XMLHttpRequest',\n 'user-agent': 'Appcelerator Titanium/3.1.1 (SAMSUNG-SGH-I747; Android API Level: 15; en-US;)',\n host: '172.16.1.170:5678',\n connection: 'Keep-Alive' }\n", "updateAuthor": { "name": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-05-30T22:31:38.000+0000", "updated": "2013-05-30T22:31:38.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }