{ "id": "63481", "key": "TIMOB-2849", "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": "12079", "description": "", "name": "Sprint 2011-39", "archived": true, "released": true, "releaseDate": "2011-10-03" }, { "id": "12470", "description": "", "name": "Release 1.7.4", "archived": true, "released": true, "releaseDate": "2011-10-31" }, { "id": "11331", "description": "", "name": "Release 1.8.0", "archived": true, "released": true, "releaseDate": "2011-10-31" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2012-01-04T10:33:06.000+0000", "created": "2011-04-15T03:31:06.000+0000", "priority": { "name": "Medium", "id": "3" }, "labels": [ "enterprise", "module_network", "qe-testadded" ], "versions": [ { "id": "11231", "name": "Release 1.5.1", "archived": true, "released": true, "releaseDate": "2011-01-24" }, { "id": "11233", "name": "Release 1.6.0", "archived": true, "released": true, "releaseDate": "2011-02-23" } ], "issuelinks": [ { "id": "17170", "type": { "id": "10002", "name": "Duplicate", "inward": "is duplicated by", "outward": "duplicates" }, "inwardIssue": { "id": "60895", "key": "TIMOB-263", "fields": { "summary": "Android: Not forwarding cookies in HTTPClient", "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": "ayeung", "key": "ayeung", "displayName": "Allen Yeung", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2014-03-13T17:45:14.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": "{html}
On Android, the \"Set-Cookie\" response header from a\r\nTi.Network.HTTPClient will only return a max of one cookie, even if\r\nmore than one cookie is set.
\r\nFor example, iPhone correctly returns the following:
\r\n\r\nthis.getResponseHeader('Set-Cookie') == 'CookieName1=CookieValue1; path=/, CookieName2=CookieValue2; path=/';
\r\n
\r\nBut Android returns the following, neglecting the second\r\nvalue:
\r\n\r\nthis.getResponseHeader('Set-Cookie') == 'CookieName1=CookieValue1; path=/';
\r\n
\r\nA comma delimited string of name=value; path=/ cookie strings\r\nshould be returned, just like on iPhone.
\r\nTested with Titanium Mobile SDK 1.5.1 and 1.6.0 (01/06/11).
\r\nFAILED on Android Device Samsung Epic 2.1
\r\nPASSED on iPhone Simulator
The sample code hits a public page I have created. The \"Get or\r\nSet Cookies\" button makes a request to the page, and the page will\r\neither a) echo the cookies we sent or b) if we didn't send cookies,\r\nsend us two cookies. \"Clear Cookies\" asks the server to expire the\r\ncookies.
\r\n\r\nvar win = Titanium.UI.createWindow({ backgroundColor:'#fff' });\r\nvar testServer = 'http://appc.me/Test/Cookies/';\r\n\r\n/**\r\n * Create a text area to show responses from the server.\r\n */\r\nvar response = Titanium.UI.createTextArea({\r\n left: 0, right: 0, top: 0, bottom: 30,\r\n value: 'Click a button below, and the response from the server will show up here!'\r\n});\r\nwin.add(response);\r\n\r\n/**\r\n * Create a button that will hit a page on a test server that echoes any cookies we send it, or sends us two cookies.\r\n */\r\nvar getOrSetCookies = Titanium.UI.createButton({ title : 'Get or Set Cookies', left: 0, bottom: 0, width: 150, height: 30 });\r\ngetOrSetCookies.addEventListener('click', function(e) {\r\n var xhr = Ti.Network.createHTTPClient();\r\n xhr.onload = function(e) {\r\n response.value = this.responseText\r\n + '\\n\\nthis.getResponseHeader(\\'Set-Cookie\\'): '\r\n + this.getResponseHeader('Set-Cookie');\r\n };\r\n xhr.open('GET', testServer + '?count=2&clear=false');\r\n xhr.send();\r\n});\r\nwin.add(getOrSetCookies);\r\n\r\n/**\r\n * Create a button that will clear the cookies on the server (set them to expire). It will tell us how many were cleared.\r\n */\r\nvar clearCookies = Titanium.UI.createButton({ title : 'Clear Cookies', right: 0, bottom: 0, width: 150, height: 30 });\r\nclearCookies.addEventListener('click', function(e) {\r\n var xhr = Ti.Network.createHTTPClient();\r\n xhr.onload = function(e) {\r\n response.value = this.responseText\r\n + '\\n\\nthis.getResponseHeader(\\'Set-Cookie\\'): '\r\n + this.getResponseHeader('Set-Cookie');\r\n };\r\n xhr.open('GET', testServer + '?count=2&clear=true');\r\n xhr.send();\r\n});\r\nwin.add(clearCookies);\r\n\r\nwin.open();
\r\n
\r\nAttached is the output from adb -d logcat. Doesn't have terribly\r\nuseful information...
\r\nbumping the priority for next scheduling round.