{ "id": "168960", "key": "TIMOB-24960", "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": "19870", "description": "", "name": "Release 6.1.2", "archived": false, "released": true, "releaseDate": "2017-08-03" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2017-07-18T22:30:17.000+0000", "created": "2017-07-14T14:44:21.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [], "versions": [ { "id": "19572", "description": "Important fixes for 6.1.0", "name": "Release 6.1.1", "archived": false, "released": true, "releaseDate": "2017-06-16" } ], "issuelinks": [], "assignee": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "updated": "2017-07-21T17:13:39.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": "Encoding authentication credentials creates characters invalid for HTTP headers.\r\n\r\n*Test case:*\r\n\r\n_index.js_\r\n\r\n{code:javascript}\r\n(function controller(args) {\r\n 'use strict';\r\n\r\n //Set events\r\n ['simplePost', 'basicAuthPost'].forEach(function (proxy) {\r\n $.addListener($[proxy], 'click', prepareRequest);\r\n });\r\n\r\n /**\r\n * @method prepareRequest\r\n * @param {object} e Callback event\r\n */\r\n function prepareRequest(e) {\r\n var withCredentials = true;\r\n\r\n if (e.source.id === 'simplePost') {\r\n withCredentials = false;\r\n }\r\n\r\n request(withCredentials);\r\n }\r\n\r\n /**\r\n * Make a request\r\n * @method request\r\n * @param {boolean} withCredentials Flag for make a auth request or not\r\n */\r\n function request(withCredentials) {\r\n var client,\r\n config,\r\n url,\r\n data;\r\n\r\n data = {\r\n message: 'This is my message'\r\n };\r\n\r\n config = {\r\n onload: success,\r\n onerror: error,\r\n timeout: 5000\r\n };\r\n\r\n if (withCredentials) {\r\n //Returns HTTP Headers in a success auth\r\n url = 'https://srvasic.upv.es/recursos/error401.asp';\r\n config.withCredentials = true;\r\n\r\n //Works\r\n //config.username = 'user';\r\n //config.password = 'p$wd';\r\n \r\n //Fails\r\n config.username = 'CR8FB51C9B3C5EDEEB959BCBCF55339FB1';\r\n config.password = '3F853CE4EB1CE3337D51B0CEE707FDCC8E0D';\r\n \r\n //Works\r\n //config.username = 'CR8FB51C9B3C5EDE';\r\n //config.password = '3F853CE4EB1CE333';\r\n } elseĀ  {\r\n //Echo return\r\n url = 'https://httpbin.org/post';\r\n }\r\n\r\n console.log('HTTP CLIENT CONFIG ' + JSON.stringify(config));\r\n\r\n client = Ti.Network.createHTTPClient(config);\r\n\r\n try {\r\n console.log('URL: ' + url);\r\n client.open('POST', url);\r\n } catch (e) {\r\n console.log('error opening client');\r\n console.log(JSON.stringify(e));\r\n }\r\n\r\n try {\r\n client.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');\r\n } catch (e) {\r\n console.log('error setting request headers');\r\n console.log(JSON.stringify(e));\r\n }\r\n\r\n try {\r\n client.send(data);\r\n } catch (e) {\r\n console.log('error sending data');\r\n console.log(JSON.stringify(e));\r\n }\r\n }\r\n\r\n /**\r\n * HttpClient Success Callback\r\n * @method success\r\n * @param {object} e Callback Event\r\n */\r\n function success(e) {\r\n console.log('Success callback: ' + this.responseText);\r\n }\r\n\r\n /**\r\n * HttpClient Error Callback\r\n * @method error\r\n * @param {object} e Callback Event\r\n */\r\n function error(e) {\r\n console.log('Error callback : ' + e.error);\r\n console.log(this.responseText);\r\n }\r\n\r\n $.index.open();\r\n\r\n})(arguments[0] || {});\r\n{code}\r\n\r\n_index.xml_\r\n\r\n{code:xml}\r\n\r\n\t\r\n\t\t\r\n\t\t\r\n\t\r\n\r\n{code}\r\n", "attachment": [], "flagged": false, "summary": "Android: TiHTTPClient credentials encoding issue.", "creator": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "subtasks": [], "reporter": { "name": "jormagar", "key": "jormagar", "displayName": "Jorge Macias Garcia", "active": true, "timeZone": "Europe/Brussels" }, "environment": "OS: Windows\r\nTarget: Nexus 5 API 25\r\nSDK: 6.1.1.GA, master", "comment": { "comments": [ { "id": "424145", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "PR: https://github.com/appcelerator/titanium_mobile/pull/9220", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2017-07-14T14:50:05.000+0000", "updated": "2017-07-14T14:50:05.000+0000" }, { "id": "424154", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "[~ybanev] Is their a backport for this ticket?", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-07-14T17:05:29.000+0000", "updated": "2017-07-14T17:06:48.000+0000" }, { "id": "424215", "author": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "body": "[~smohammed], sorry for the delay, here is the backport:\r\n6_1_X PR: https://github.com/appcelerator/titanium_mobile/pull/9222", "updateAuthor": { "name": "ybanev", "key": "ybanev", "displayName": "Yordan Banev", "active": true, "timeZone": "Europe/Athens" }, "created": "2017-07-17T08:14:23.000+0000", "updated": "2017-07-17T08:14:23.000+0000" }, { "id": "424533", "author": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fix in SDK Version 6.2.0.v20170719160617 and SDK Version: 6.1.2.v20170720023139. Test and other information can be found at: \r\nMaster: https://github.com/appcelerator/titanium_mobile/pull/9220\r\n6_1_X: https://github.com/appcelerator/titanium_mobile/pull/9222", "updateAuthor": { "name": "smohammed", "key": "smohammed", "displayName": "Samir Mohammed", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2017-07-21T17:13:04.000+0000", "updated": "2017-07-21T17:13:04.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }