{ "id": "151141", "key": "TIMOB-19505", "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": [], "resolution": { "id": "2", "description": "The problem described is an issue which will never be fixed.", "name": "Won't Fix" }, "resolutiondate": "2016-07-21T01:44:07.000+0000", "created": "2015-09-13T07:07:13.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [], "issuelinks": [ { "id": "48972", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "outwardIssue": { "id": "115058", "key": "TIMOB-14012", "fields": { "summary": "Android: Parity - XHR user agent is null on Android, populated on iOS", "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": "emerriman", "key": "emerriman", "displayName": "Eric Merriman ", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2017-03-23T22:30: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": "10224", "name": "TiAPI", "description": "This component is used for cross-platform API work. Specifications are most likely to use this component." } ], "description": "On Android and iOS the addition of the default User-Agent string for each http network request is impacting the expected response of the network request.\r\n\r\nThe code that is causing the issue:\r\nhttps://github.com/appcelerator/titanium_mobile/blob/4_1_X/android/modules/network/src/java/ti/modules/titanium/network/TiHTTPClient.java#L943\r\n\r\nThe issue seems to be that the protected endpoint is validating against known UserAgents and returning an error response if it is not an approved UserAgent string. Trying to set the user agent with Ti.Network.HTTPClient.setRequestHeader appends the header, but does not remove the default header.\r\n", "attachment": [], "flagged": false, "summary": "Ti.Network.HTTPClient Default addition of Appcelerator User-Agent header can impact success of network calls", "creator": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "subtasks": [], "reporter": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "environment": null, "comment": { "comments": [ { "id": "363703", "author": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "body": "Here is the like code on iOS that is causing the issue.\r\n\r\nhttps://github.com/appcelerator/titanium_mobile/blob/4_1_X/iphone/Classes/TiNetworkHTTPClientProxy.m#L50\r\n", "updateAuthor": { "name": "bgrantges@appcelerator.com", "key": "bgrantges", "displayName": "Bert Grantges", "active": false, "timeZone": "America/Chicago" }, "created": "2015-09-13T15:49:01.000+0000", "updated": "2015-09-13T15:49:01.000+0000" }, { "id": "363788", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "From the docs: http://docs.appcelerator.com/platform/latest/#!/api/Titanium.Network.HTTPClient, an \"HTTP client object that (mostly) implements the XMLHttpRequest specification.\"\r\n\r\nFrom the XMLHttpRequest specification, values are appended: http://www.w3.org/TR/XMLHttpRequest/#the-setrequestheader()-method\r\n\r\nI don't know why the endpoint can't check for the new user agent. However, if we HAVE to overwrite the existing value, we need a new method to allow that.\r\n", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-14T16:44:46.000+0000", "updated": "2015-09-14T16:44:46.000+0000" }, { "id": "363871", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Agreed with Ingo. we are appending the values since it's the industry standard so there's no reason why it's failing. \r\nHowever, without introducing a new method, you can try this.\r\n{code}\r\nrequest.setRequestHeader('User-Agent', null); //this deletes any existing value\r\nrequest.setRequestHeader('User-Agent', 'yourNewAgent');\r\n{code}", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2015-09-15T02:32:56.000+0000", "updated": "2015-09-15T02:32:56.000+0000" }, { "id": "365114", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Please confirm this works as expected. If so we will resolve as \"Won't Fix\"", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-09-28T16:33:06.000+0000", "updated": "2015-09-28T16:33:06.000+0000" }, { "id": "391130", "author": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "body": "@Ingo\r\n\r\nThe workaround proposed by @Chee works for overriding the User-Agent.\r\n\r\nCan we assume this is future-proof on Ti SDK 5.X and 6.X ?\r\n\r\n\r\n", "updateAuthor": { "name": "ygbr", "key": "ygbr", "displayName": "Ygor Lemos", "active": true, "timeZone": "America/Sao_Paulo" }, "created": "2016-07-20T21:35:37.000+0000", "updated": "2016-07-20T21:35:37.000+0000" }, { "id": "391131", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~cng] ^^ fixing reference. Can you comment on the future-proofness of this?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2016-07-20T21:38:14.000+0000", "updated": "2016-07-20T21:38:14.000+0000" }, { "id": "391151", "author": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Yes. it's future proof.", "updateAuthor": { "name": "cng", "key": "cng", "displayName": "Chee Kiat Ng", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2016-07-21T01:43:40.000+0000", "updated": "2016-07-21T01:43:40.000+0000" }, { "id": "415441", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as Won't Fix with reference to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-23T22:30:01.000+0000", "updated": "2017-03-23T22:30:01.000+0000" } ], "maxResults": 8, "total": 8, "startAt": 0 } } }