{ "id": "110240", "key": "TIMOB-13400", "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": "15113", "description": "2013 Sprint 08 BB", "name": "2013 Sprint 08 BB", "archived": true, "released": true, "releaseDate": "2013-04-22" }, { "id": "15106", "description": "2013 Sprint 08", "name": "2013 Sprint 08", "archived": true, "released": true, "releaseDate": "2013-04-22" }, { "id": "14982", "description": "Release 3.2.0", "name": "Release 3.2.0", "archived": false, "released": true, "releaseDate": "2013-12-19" } ], "resolution": { "id": "1", "description": "A fix for this issue is checked into the tree and tested.", "name": "Fixed" }, "resolutiondate": "2013-04-10T22:09:59.000+0000", "created": "2013-02-26T17:05:32.000+0000", "priority": { "name": "High", "id": "2" }, "labels": [], "versions": [ { "id": "14162", "description": "Release 3.1.0", "name": "Release 3.1.0", "archived": true, "released": true, "releaseDate": "2013-04-16" } ], "issuelinks": [], "assignee": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "updated": "2013-11-14T00:29:38.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": "10230", "name": "BlackBerry", "description": "BlackBerry Platform" } ], "description": "h2. Problem\r\nFor reading Google RSS feeds it is required to encode the second url part.\r\nWith iOS this is working as expected, with BlackBerry not.\r\n\r\nI did some logging using Wireshark an it looks like that during GET the already encoded url gets encoded once more.\r\nSee logs below.\r\n\r\nh3. actual behavior\r\nwrong encoding during GET\r\n\r\nh3. expected behavior\r\ncorrect encoding\r\n\r\nh2. Test case (app.js)\r\n{code}\r\nvar win = Ti.UI.createWindow({\r\n backgroundColor : 'white',\r\n layout : 'vertical'\r\n});\r\n\r\nfunction reloadFeed(url) {\r\n\r\n Ti.API.info('---> url ' + url);\r\n\r\n var xhr = Ti.Network.createHTTPClient({\r\n onload : function(e) {\r\n Ti.API.info('---> xhr onload');\r\n Ti.API.info('---> xhr status=' + this.status);\r\n Ti.API.info('---> xhr responseText=' + this.responseText);\r\n\r\n var response = JSON.parse(this.responseText);\r\n\r\n for (var i = 0, j = response.responseData.feed.entries.length; i < j; i++) {\r\n Ti.API.info('---> xhr responseText Title ' + i + ' =' + response.responseData.feed.entries[i].title);\r\n Ti.API.info('---> xhr responseText Link ' + i + ' =' + response.responseData.feed.entries[i].link);\r\n //Ti.API.info('---> xhr responseText publishedDate ' + i + ' =' + response.responseData.feed.entries[i].publishedDate);\r\n };\r\n\r\n },\r\n onsendstream : function(e) {\r\n Ti.API.info('---> xhr onsendstream');\r\n },\r\n onreadystatechange : function(e) {\r\n Ti.API.info('---> xhr onreadystatechange readyState=' + this.readyState);\r\n },\r\n onerror : function(e) {\r\n Ti.API.info('---> xhr onerror ' + e.error);\r\n }\r\n });\r\n // xhr.autoEncodeUrl = false; // << don't help\r\n xhr.open('GET', url);\r\n xhr.send();\r\n}\r\n\r\nbutton = Ti.UI.createButton({\r\n title : 'reload feed',\r\n bottom : 0,\r\n height : '10%',\r\n width : Ti.UI.FILL // << don't work with BlackBerry\r\n});\r\nbutton.addEventListener(\"click\", function(e) {\r\n //var urlAjax = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&callback=callBack&q=';\r\n var urlAjax = 'http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=';\r\n var urlFeed = 'http://news.google.com/news?ned=us&topic=t&output=rss';\r\n // << this url part has to be encoded\r\n\r\n urlFeed = encodeURIComponent(urlFeed);\r\n Ti.API.info('---> encoded urlFeed=' + urlFeed);\r\n\r\n reloadFeed(urlAjax + urlFeed);\r\n\r\n});\r\n\r\nwin.add(button);\r\n\r\nwin.open();\r\n{code}\r\n\r\nh2. Logs\r\n\r\nh3. BlackBerry Titanium App log\r\n{code}\r\n[INFO] ---> url http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http%3A%2F%2Fnews.google.com%2Fnews%3Fned%3Dus%26topic%3Dt%26output%3Drss\r\n[INFO] ---> xhr onreadystatechange readyState=1\r\n[INFO] ---> xhr onreadystatechange readyState=3\r\n[INFO] ---> xhr onreadystatechange readyState=4\r\n[INFO] ---> xhr onload\r\n[INFO] ---> xhr status=undefined\r\n[INFO] ---> xhr responseText={\"responseData\": null, \"responseDetails\": \"The specified feed URL is invalid\", \"responseStatus\": 400}\r\nSyntaxError: Unexpected end of input\r\n{code}\r\n\r\nh3. iOS Titanium App log\r\n{code}\r\n[INFO] : \b\b \b ---> encoded urlFeed=http%3A%2F%2Fnews.google.com%2Fnews%3Fned%3Dus%26topic%3Dt%26output%3Drss\r\n[INFO] : \b\b \b ---> url http://ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=10&q=http%3A%2F%2Fnews.google.com%2Fnews%3Fned%3Dus%26topic%3Dt%26output%3Drss\r\n[INFO] : \b\b \b ---> xhr onreadystatechange readyState=1\r\n[INFO] : \b\b \b ---> xhr onreadystatechange readyState=2\r\n[INFO] : \b\b \b ---> xhr onreadystatechange readyState=3\r\n[INFO] : \b\b \b ---> xhr onreadystatechange readyState=4\r\n[INFO] : \b\b \b ---> xhr onload\r\n[INFO] : \b\b \b ---> xhr status=200\r\n[INFO] : \b\b \b ---> xhr responseText={\"responseData\": {\"feed\":{\"feedUrl\":\"http://news.google.com/news?ned\\u003dus\\u0026topic\\u003dt\\u0026output\\u003drss\",\"title\":\"Sci/Tech - Google News\",\"link\":\"http://news.google.com/news?ned\\u003dus\\u0026amp;hl\\u003den\\u0026amp;topic\\u003dt\",\"author\":\"\",\"description\":\"Google News\",\"type\":\"rss20\",\"entries\":[{\"title\":\"Google switches on Google+ sign-ins, in-app posting - CNET\",\"link\":\"http://news.google.com/news/url?sa\\u003dt\\u0026fd\\u003dR\\u0026usg\\u003dAFQjCNF_NsAUYYOMNGi85B_CJLUDYpCp8A\\u0026url\\u003dhttp://news.cnet.com/8301-10812_3-57571255/google-switches-on-google-sign-ins-in-app-posting/\",\"author\":\"\",\"publishedDate\":\"Tue, 26 Feb 2013 08:09:18 <> \"responseDetails\": null, \"responseStatus\": 200}\r\n[INFO] : \b\b \b ---> xhr responseText Title 0 =Google switches on Google+ sign-ins, in-app posting - CNET\r\n[INFO] : \b\b \b ---> xhr responseText Link 0 =http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNF_NsAUYYOMNGi85B_CJLUDYpCp8A&url=http://news.cnet.com/8301-10812_3-57571255/google-switches-on-google-sign-ins-in-app-posting/\r\n[INFO] : \b\b \b ---> xhr responseText Title 1 =Pluto's smallest moon may be named 'Vulcan' - Financial Express\r\n[INFO] : \b\b \b ---> xhr responseText Link 1 =http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNGTAtW-D76E5l1yU5fOMPh-8_Jpzg&url=http://www.financialexpress.com/news/plutos-smallest-moon-may-be-named-vulcan/1080092\r\n[INFO] : \b\b \b ---> xhr responseText Title 2 =Samsung announces new Galaxy smartphone launch - The Guardian\r\n[INFO] : \b\b \b ---> xhr responseText Link 2 =http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNHvMVry7ufpmDzieZ9CiQOtboljTQ&url=http://www.guardian.co.uk/technology/2013/feb/25/samsung-announces-new-galaxy-smartphone-launch\r\n….<>\r\n{code}\r\n\r\nh3. BlackBerry Wireshark log\r\n{code}\r\nGET /ajax/services/feed/load?v=1.0&num=10&q=http%253A%252F%252Fnews.google.com%252Fnews%253Fned%253Dus%2526topic%253Dt%2526output%253Drss HTTP/1.1\r\nConnection: Keep-Alive\r\nAccept-Encoding: gzip\r\nAccept-Language: en-US,*\r\nUser-Agent: Mozilla/5.0\r\nHost: ajax.googleapis.com\r\n\r\nHTTP/1.1 200 OK\r\nCache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache\r\nExpires: Fri, 01 Jan 1990 00:00:00 GMT\r\nDate: Tue, 26 Feb 2013 16:31:12 GMT\r\nContent-Type: text/javascript; charset=utf-8\r\nX-Embedded-Status: 400\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: SAMEORIGIN\r\nX-XSS-Protection: 1; mode=block\r\nServer: GSE\r\nTransfer-Encoding: chunked\r\n\r\n65\r\n{\"responseData\": null, \"responseDetails\": \"The specified feed URL is invalid\", \"responseStatus\": 400}\r\n0\r\n{code}\r\n\r\nh3. iOS Wireshark log\r\n{code}\r\nGET /ajax/services/feed/load?v=1.0&num=10&q=http%3A%2F%2Fnews.google.com%2Fnews%3Fned%3Dus%26topic%3Dt%26output%3Drss HTTP/1.1\r\nHost: ajax.googleapis.com\r\nAccept-Encoding: gzip\r\nUser-Agent: Appcelerator Titanium/3.1.0.v20130223030327 (iPhone Simulator/6.1; iPhone OS; en_US;)\r\nConnection: close\r\nX-Requested-With: XMLHttpRequest\r\n\r\nHTTP/1.1 200 OK\r\nCache-Control: no-cache, no-store, max-age=0, must-revalidate\r\nPragma: no-cache\r\nExpires: Fri, 01 Jan 1990 00:00:00 GMT\r\nDate: Tue, 26 Feb 2013 16:26:40 GMT\r\nContent-Type: text/javascript; charset=utf-8\r\nX-Backend-Content-Length: 34403\r\nX-Embedded-Status: 200\r\nX-Content-Type-Options: nosniff\r\nX-Frame-Options: SAMEORIGIN\r\nX-XSS-Protection: 1; mode=block\r\nServer: GSE\r\nConnection: close\r\n\r\n{\"responseData\": {\"feed\":{\"feedUrl\":\"http://news.google.com/news?ned\\u003dus\\u0026topic\\u003dt\\u0026output\\u003drss\",\"title\":\"Sci/Tech - Google News\",\"link\":\"http://news.google.com/news?ned\\u003dus\\u0026amp;hl\\u003den\\u0026amp;topic\\u003dt\",\"author\":\"\",\"description\":\"Google News\",\"type\":\"rss20\",\"entries\":[{\"title\":\"Samsung says it plans to double its tablet ... - CNET\",\"link\":\"http://news.google.com/news/url?sa\\u003dt\\u0026fd\\u003dR\\u0026usg\\u003dAFQjCNFTxcyFX4JUWi5bn6Xw1bzloIbgEQ\\u0026url\\u003dhttp://reviews.cnet.com/8301-13970_7-57571311-78/samsung-says-it-plans-to-double-its-tablet-sales-this-year/\",\"author\":\"\",\"publishedDate\":\"Tue, 26 Feb 2013 07:43:39 -0800\",\"contentSnippet\":\"ZDNetSamsung says it plans to double its tablet ...CNETBut the company warned that smartphone sales growth would likely slow ...\",\"content\":\"\\u003ctable border\\u003d\\\"0\\\" cellpadding\\u003d\\\"2\\\" cellspacing\\u003d\\\"7\\\" style\\u003d\\\"vertical-align:top\\\"\\u003e\\u003ctr\\u003e\\u003ctd width\\u003d\\\"80\\\" align\\u003d\\\"center\\\" valign\\u003d\\\"top\\\"\\u003e\\u003cfont style\\u003d\\\"font-size:85%;font-family:arial,sans-serif\\\"\\u003e\\u003ca href\\u003d\\\"http://news.google.com/news/url?sa\\u003dt\\u0026amp;fd\\u003dR\\u0026amp;usg\\u003dAFQjCNHAOFvscT3U9dvTZFVctkdM5vCDtA\\u0026amp;url\\u003dhttp://www.zdnet.com/samsung-galaxy-s4-to-launch-on-14-\r\n...\r\n...\r\n \"responseDetails\": null, \"responseStatus\": 200}\r\n{code}", "attachment": [], "flagged": false, "summary": "BlackBerry: Titanium.Network.HTTPClient invalid url when using encodeURIComponent()", "creator": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "subtasks": [], "reporter": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "environment": "Mac OS X 10.7.5\r\n\r\nTitanium Studio, build: 3.1.0.201302221817\r\n\r\nmobilesdk-3.1.0.v20130223030327-osx\r\n\r\nBlackBerry 10 Dev Alpha Simulator BB10_0_10.261\r\n\r\nBlackBerry 10 Dev Alpha B, Software Release: 10.9.10.35\r\n\r\niPhone Simulator 6.1 (10B141)\r\n", "comment": { "comments": [ { "id": "239909", "author": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "body": "The % inside the encoded string gets encoded again to %25, I think.", "updateAuthor": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-02-27T00:16:49.000+0000", "updated": "2013-02-27T00:16:49.000+0000" }, { "id": "240003", "author": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "body": "This ticket has been assigned to Tony. \nIs that correct for a BlackBerry ticket?\n\nThanks,\nMatthias", "updateAuthor": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-02-27T16:52:14.000+0000", "updated": "2013-02-27T16:52:14.000+0000" }, { "id": "240004", "author": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Definitely not, probably more likely should be assigned to Russ McMahon. I'm not sure exactly how it would have been assigned to me.", "updateAuthor": { "name": "tlukasavage", "key": "tlukasavage", "displayName": "Tony Lukasavage", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-02-27T16:56:01.000+0000", "updated": "2013-02-27T16:56:01.000+0000" }, { "id": "240005", "author": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "body": "Thanks Tony!", "updateAuthor": { "name": "mkroeger", "key": "mkroeger", "displayName": "Matthias Kroeger", "active": true, "timeZone": "Europe/Berlin" }, "created": "2013-02-27T16:58:17.000+0000", "updated": "2013-02-27T16:58:17.000+0000" }, { "id": "246960", "author": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Also found a bug with accessing the \"responseText\" multiple times.\nDuplicate accesses would return an empty string. Fixed.", "updateAuthor": { "name": "joshroesslein", "key": "joshroesslein", "displayName": "Josh Roesslein", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-04-10T22:09:46.000+0000", "updated": "2013-04-10T22:09:46.000+0000" }, { "id": "279466", "author": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "body": "Verified fixed on:\nMac OSX 10.9 Mavericks\nTitanium Studio, build: 3.2.0.201311122225\nTitanium SDK, build: 3.2.0.v20131113094843\nCLI: 3.2.0\nAlloy: 1.3.0\nBlackBerry Simulator: 10.2.0.1791\n\nFeed is obtained successfully and logged in the console as expected.\nNo invalid URL is used when encoding.\nClosing.", "updateAuthor": { "name": "sdowse", "key": "sdowse", "displayName": "Samuel Dowse", "active": true, "timeZone": "America/Los_Angeles" }, "created": "2013-11-14T00:29:32.000+0000", "updated": "2013-11-14T00:29:32.000+0000" } ], "maxResults": 6, "total": 6, "startAt": 0 } } }