Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1491] Android: Auto Encode Network URLs

GitHub Issuen/a
TypeBug
PriorityMedium
StatusClosed
ResolutionFixed
Resolution Date2011-04-17T01:56:19.000+0000
Affected Version/sn/a
Fix Version/sRelease 1.5.0 M03
ComponentsAndroid
Labelsandroid, defect
ReporterDon Thorp
AssigneeMarshall Culpepper
Created2011-04-15T02:54:11.000+0000
Updated2011-04-17T01:56:19.000+0000

Description

See iPhone Impl. http://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUtils.m#L507"> http://github.com/appcelerator/titanium_mobile/blob/master/iphone/Classes/TiUtils.m#L507

See http://developer.appcelerator.com/helpdesk/view/34201">Helpdesk 34201

Attachments

FileDateSize
escaped.png2011-04-15T02:54:11.000+000038402

Comments

  1. Bill Dawson 2011-04-15

    Sample exception when not encoded properly (in this case the @ sign):

       Caused by: java.net.URISyntaxException: Illegal character in query at index XX: http://xx.xx.com/sub2.php?uname=ld@xx.com&;appname=testt&desc=test
       
  2. Jeff Haynie 2011-04-15

    (from [c7d39ced1783389ae16ab299bf729366bfdae1bc]) Encode URIs. [#1491] http://github.com/appcelerator/titanium_mobile/commit/c7d39ced1783389ae16ab299bf729366bfdae1bc"> http://github.com/appcelerator/titanium_mobile/commit/c7d39ced17833...

  3. Bill Dawson 2011-04-15

    Additional commit (forgot the auto comment here):
    http://github.com/appcelerator/titanium_mobile/commit/768616c5f7595b621c75cb35a8abdccb74461f3e"> http://github.com/appcelerator/titanium_mobile/commit/768616c5f7595...

    We're waiting for a fail case. The fail case from that helpdesk ticket is not a fail case anymore.

  4. Bill Dawson 2011-04-15

    This has been fixed for a while, and though we tried, we never got any confirmation from the customer (see http://developer.appcelerator.com/helpdesk/view/34201">Helpdesk 34201. The original url given by the customer contained both at-signs (@) and slashes. In case that url is private, here's a dummy version of it that we can use for testing, contained inside this test app.js:

       Titanium.UI.setBackgroundColor('#000');
       var URL = 'http://developer.appcelerator.com/sub2.php?uname=ld@appcelerator.com.com&;appname=testt&desc=test&success=why&datesub=2010/08/01&phoneid=1';
       
       var xhr = Ti.Network.createHTTPClient();
       
       xhr.onerror = function(e) {
           Ti.API.error('ERROR: ' + e.error);
       };
       xhr.onload = function(e) {
           Ti.API.info('XHR SUCCESS');
       };
       
       xhr.open('GET', URL);
       xhr.send();
       

    (Again, that's a dummy url, so you will get a 404 as expected.)

    This is tough to test without a protocol analyzer since we don't expose any APIs to show what the "final" url being used is. This screenshot is me using Wireshark, and you can see that the at-sign has been properly escaped to %40, and the slashes to %2F.

  5. Thomas Huelbert 2011-04-15

    closing cuz Bill says its closed :)

  6. Bill Dawson 2011-04-15

    (from [bcdf46569b53be86fc029577ec5147abda6a6c17]) [#2589 state:fixed-in-qa][#1491] Add autoEncodeUrl property to HTTPClient (default=true, thus preserving current behavior). Setting to false means your url will remain untouched. Add drillbit unit tests. https://github.com/appcelerator/titanium_mobile/commit/bcdf46569b53be86fc029577ec5147abda6a6c17"> https://github.com/appcelerator/titanium_mobile/commit/bcdf46569b53...

  7. Bill Dawson 2011-04-15

    (from [fbc043377a7e44753497c3ec0c9979c0cb53b359]) [#2589 state:fixed-in-qa][#1491] Add autoEncodeUrl property to HTTPClient (default=true, thus preserving current behavior). Setting to false means your url will remain untouched. Add drillbit unit tests. https://github.com/appcelerator/titanium_mobile/commit/fbc043377a7e44753497c3ec0c9979c0cb53b359"> https://github.com/appcelerator/titanium_mobile/commit/fbc043377a7e...

JSON Source