{ "id": "135485", "key": "TIMOB-17566", "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": "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": "2015-01-06T21:52:53.000+0000", "created": "2014-08-27T22:09:17.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "network", "parity", "qe-automatedtest" ], "versions": [ { "id": "15971", "description": "Release 3.2.3", "name": "Release 3.2.3", "archived": false, "released": true, "releaseDate": "2014-04-30" }, { "id": "15422", "description": "Release 3.3.0", "name": "Release 3.3.0", "archived": false, "released": true, "releaseDate": "2014-07-16" } ], "issuelinks": [ { "id": "40376", "type": { "id": "10003", "name": "Relates", "inward": "relates to", "outward": "relates to" }, "inwardIssue": { "id": "122409", "key": "TIMOB-15871", "fields": { "summary": "HTTPClient: setting autoRedirect off for 302s on Android calls onerror", "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": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "updated": "2015-02-16T07:14:09.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\n\r\nWhen using Ti.Network.createHTTPClient and setting the properties in the create method to false it is ignored and they default to true. \r\n\r\nThe workaround is to use one of the two ways below to set the properties to false.\r\n\r\n{code}\r\nclient.setAutoRedirect(false);\r\nclient.setAutoEncodeUrl(false);\r\n{code}\r\n\r\nor\r\n\r\n{code}\r\nclient.autoRedirect = false;\r\nclient.autoEncodeUrl = false;\r\n{code}\r\n\r\nh5.Steps To Reproduce\r\n\r\n1. Create a project and add the app.js attached\r\n2. Build to an Android device/simulator and then tap the button\r\n\r\nh5.Actual Result\r\n\r\nThe properties set to true, the URL is auto-redirected and auto-encoded, in the Studio console you should see what is attached in consoleLog.txt\r\n\r\nh5.Expected Result\r\n\r\nThe properties should stay false and it should not auto-redirect or auto-encode the URL.\r\n\r\n", "attachment": [ { "id": "50815", "filename": "app.js", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-08-27T22:09:17.000+0000", "size": 1580, "mimeType": "text/javascript" }, { "id": "50814", "filename": "consoleLog.txt", "author": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "created": "2014-08-27T22:09:17.000+0000", "size": 1608, "mimeType": "text/plain" } ], "flagged": false, "summary": "Android: setting createHTTPClient properties autoRedirect and autoEncodeURL are ignored", "creator": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "subtasks": [], "reporter": { "name": "eharris", "key": "eharris", "displayName": "Ewan Harris", "active": true, "timeZone": "Europe/Dublin" }, "environment": "Mac OSX 10.9.4\r\nAppcelerator Studio, build: 3.4.0.201408270900\r\nTitanium SDK build: 3.3.0.GA, 3.2.3.GA\r\nTitanium CLI, build: 3.3.0\r\nAlloy: 1.3.1\r\n", "closedSprints": [ { "id": 291, "state": "closed", "name": "2015 Sprint 01 SDK", "startDate": "2015-01-03T01:00:00.000Z", "endDate": "2015-01-17T01:00:00.000Z", "completeDate": "2015-01-19T17:24:40.828Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "320691", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "FYI.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-27T22:39:00.000+0000", "updated": "2014-08-27T22:39:00.000+0000" }, { "id": "320924", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Docs to not specify otherwise, so it's assumed you can do this in the constructor. Appears to work for iOS.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-28T23:56:35.000+0000", "updated": "2014-08-28T23:56:35.000+0000" }, { "id": "337781", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "To allow this in Android when creating HTTPClient.\r\n\r\nPR: https://github.com/appcelerator/titanium_mobile/pull/6532\r\n\r\n{code}\r\n\r\nvar win1 = Titanium.UI.createWindow({\r\n \r\n});\r\n \r\n// Create a Button.\r\nvar aButton = Ti.UI.createButton({\r\n title : 'aButton',\r\n});\r\n \r\n// Listen for click events.\r\naButton.addEventListener('click', function() {\r\n \r\n var url = \"http://httpbin.org/redirect/2\";\r\n var client = Ti.Network.createHTTPClient({\r\n // function called when the response data is available\r\n onload : function(e) {\r\n Ti.API.info('e ' + JSON.stringify(e));\r\n Ti.API.info(\"Received HEADERS_RECEIVED: \" + this.HEADERS_RECEIVED);\r\n Ti.API.info(\"Received status: \" + this.status);\r\n alert(this.status);\r\n Ti.API.info(\"Received statusText: \" + this.statusText);\r\n Ti.API.info(\"Received responseText: \" + this.responseText);\r\n \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 Ti.API.info(\"Received HEADERS_RECEIVED: \" + this.HEADERS_RECEIVED);\r\n Ti.API.info(\"Received status: \" + this.status);\r\n alert(this.status);\r\n Ti.API.info(\"Received statusText: \" + this.statusText);\r\n Ti.API.info(\"Received responseText: \" + this.responseText);\r\n \r\n alert('error');\r\n },\r\n timeout : 5000, // in milliseconds*\r\n \r\n \t\tautoRedirect : false,\r\n \tautoEncodeUrl : false,\r\n \r\n });\r\n \r\n\r\n // Prepare the connection.\r\n \r\n client.open(\"GET\", url);\r\n // Send the request.\r\n client.send();\r\n \r\n});\r\n \r\n// Add to the parent view.\r\nwin1.add(aButton);\r\n \r\nwin1.open();\r\n\r\n{code}\r\n\r\nExpected behavior running this code with PR above: Status code 200 (OK)\r\nOtherwise we'd get status 302 (needs redirecting)", "updateAuthor": { "name": "hpham", "key": "hpham", "displayName": "Hieu Pham", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-01-05T07:34:16.000+0000", "updated": "2015-01-06T21:52:43.000+0000" }, { "id": "337854", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Not a regression, moving out of 3.5.0.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2015-01-05T18:33:12.000+0000", "updated": "2015-01-05T18:33:12.000+0000" }, { "id": "343035", "author": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "body": "Useful link to test autoEncodeURL:\r\nvar url = \"http://chart.apis.google.com/chart?chco=666666,555555,444444,333333,222222&chs=288x150&cht=p&chd=t:36,15,12,10,26&chdl=xyz%7Cabc%7Cdef%7Cghi%7Cjkl&chdlp=b&chf=c,s,ffffff%7Cbg,s,ffffff&chl=36%|15%|12%|10%|26%\";\r\n", "updateAuthor": { "name": "msamah", "key": "msamah", "displayName": "Ashraf Abu", "active": false, "timeZone": "Asia/Singapore" }, "created": "2015-02-12T07:13:52.000+0000", "updated": "2015-02-12T07:13:52.000+0000" }, { "id": "343040", "author": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "body": "Verified with below Test Environment:\r\n1. Mac OSX Yosemite 10.10.1\r\n2. Appcelerator Studio, build: 4.0.0.201502111458\r\n3. Titanium SDK, build: 4.0.0.v20150211151855 \r\n4. Titanium CLI, build: 3.6.0-dev\r\n5. Alloy: 1.5.1\r\n6. Nexus 6 with Android 5.0\r\n\r\nThe properties autoRedirect and autoEncodeUrl are set as false.\r\nThe URL is neither auto-redirected nor auto-encoded as seen in the studio console.\r\n\r\nClosing this ticket.", "updateAuthor": { "name": "kagrawal", "key": "kagrawal", "displayName": "Khushbu Agrawal", "active": true, "timeZone": "Asia/Shanghai" }, "created": "2015-02-12T10:07:13.000+0000", "updated": "2015-02-12T10:07:13.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }