{ "id": "133784", "key": "TIMOB-17460", "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": "5", "description": "All attempts at reproducing this issue failed, or not enough information was available to reproduce the issue. Reading the code produces no clues as to why this behavior would occur. If more information appears later, please reopen the issue.", "name": "Cannot Reproduce" }, "resolutiondate": "2014-10-21T16:18:42.000+0000", "created": "2014-07-27T06:09:39.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [ "ios" ], "versions": [], "issuelinks": [], "assignee": { "name": "mdadu", "key": "mdadu", "displayName": "Muhammad Dadu", "active": false, "timeZone": "Europe/London" }, "updated": "2017-03-21T22:08:34.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": "Here is why and how it can be fixed.\r\n\r\nhttps://github.com/appcelerator/APSHTTPClient/pull/16\r\n\r\nI debugged why autoRedirect property of Ti.Network.createHTTPClient is ignored for 3.3.0.GA. The default property of autoRedirect is true.\r\n\r\nWhen autoRedirect = false is set, self.response.status is always zero in APSHTTPRequest.m\r\nTherefore the redirect check if statement\r\n\r\nif (!self.redirects && self.response.status != 0)\r\n\r\ndoes always fall through. \r\n\r\n[self.response updateResponseParamaters:response];\r\n\r\nneeds to be called in advance", "attachment": [], "flagged": false, "summary": "iOS: Ti.Network.createHTTPClient autoRedirect = false is ignored", "creator": { "name": "kazuyukitanimura@gmail.com", "key": "kazuyukitanimura@gmail.com", "displayName": "k", "active": true, "timeZone": "America/Los_Angeles" }, "subtasks": [], "reporter": { "name": "kazuyukitanimura@gmail.com", "key": "kazuyukitanimura@gmail.com", "displayName": "k", "active": true, "timeZone": "America/Los_Angeles" }, "environment": "3.3.0.GA", "closedSprints": [ { "id": 230, "state": "closed", "name": "2014 Sprint 21 SDK", "startDate": "2014-10-13T22:00:57.270Z", "endDate": "2014-10-25T00:00:00.000Z", "completeDate": "2014-10-27T16:33:06.432Z", "originBoardId": 114 } ], "comment": { "comments": [ { "id": "318748", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "3.4.0 is moved forward, and 3.5.0 is taking its place in the calendar.", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-14T21:31:57.000+0000", "updated": "2014-08-14T21:31:57.000+0000" }, { "id": "320688", "author": { "name": "wluu", "key": "wluu", "displayName": "Wilson Luu", "active": false, "timeZone": "America/Los_Angeles" }, "body": "One thing to note, I was not able to reproduce this issue on iOS. The autoRedirect property is respected: \r\n\r\n* If autoRedirect = true, then the target url will be auto-redirected and return status 200\r\n* If autoRedirect = false, then the target url will not be auto-redirected and return status 302\r\n\r\n*Tested on:*\r\nAppcelerator Studio, build: 3.3.0.201407111535\r\nSDK build: 3.3.0.GA\r\nCLI: 3.3.0\r\nAlloy: 1.4.1\r\nXcode: 5.1.1\r\nDevices: iphone 5 (7.1.1)\r\n\r\nAnd, here is the app.js I used to verify this ticket:\r\n{code}\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('onload---------------------------------------------');\r\n Ti.API.info(\"Received HEADERS_RECEIVED: \" + this.HEADERS_RECEIVED);\r\n Ti.API.info(\"Received status: \" + 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('onerror---------------------------------------------');\r\n Ti.API.info(\"Received HEADERS_RECEIVED: \" + this.HEADERS_RECEIVED);\r\n Ti.API.info(\"Received status: \" + 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,\r\n autoRedirect : false, // CHANGE ME\r\n autoEncodeUrl : 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{code}\r\n", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-27T22:25:21.000+0000", "updated": "2014-10-20T21:17:20.000+0000" }, { "id": "320909", "author": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~kazuyukitanimura@gmail.com] Can you reproduce it with the code listed above?", "updateAuthor": { "name": "ingo", "key": "ingo", "displayName": "Ingo Muschenetz", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-08-28T22:55:50.000+0000", "updated": "2014-08-28T22:55:50.000+0000" }, { "id": "328682", "author": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Can't reproduce this issue.\r\n\r\nTested using [~wluu]'s example code above.\r\nh6. Environment \r\nTiSDK 3.4.0.GA iOS Sim 8.0\r\nTiSDK 3.3.0.GA iPhone 5S iOS 8.0.2\r\n\r\n[~kazuyukitanimura@gmail.com] please test using the example code above without your fix and let us know your results. Thank you!", "updateAuthor": { "name": "jalter", "key": "jalter", "displayName": "Jon Alter", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2014-10-20T21:21:42.000+0000", "updated": "2014-10-20T22:04:40.000+0000" }, { "id": "328833", "author": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Can not reproduce with sample code provided.\r\n", "updateAuthor": { "name": "vduggal", "key": "vduggal", "displayName": "Vishal Duggal", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2014-10-21T16:18:42.000+0000", "updated": "2014-10-21T16:18:42.000+0000" }, { "id": "414539", "author": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "body": "Closing ticket as the issue cannot be reproduced and due to the above comments.", "updateAuthor": { "name": "lmorris", "key": "lmorris", "displayName": "Lee Morris", "active": false, "timeZone": "America/Los_Angeles" }, "created": "2017-03-21T22:08:34.000+0000", "updated": "2017-03-21T22:08:34.000+0000" } ], "maxResults": 9, "total": 9, "startAt": 0 } } }