Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-1461] HTTP PUT method fails with SDK 1.4.0 due to url-encoded path

GitHub Issuen/a
Resolution Date2011-04-17T01:56:14.000+0000
Affected Version/sn/a
Fix Version/sn/a
Labelsencoded, encoding, get, httpclient, ios, method, percent, put, url
ReporterMartin Lasak
AssigneeJeff Haynie


We upgraded to Titanium Mobile SDK from 1.3.0 to 1.4.0 and use the same code base, but the effect differs.

Trying to perform a HTTP request with PUT method fails and results always in call of onerror and in a 404 errorcode.
Due to Wireshark analysis of HTTP request, we figured out that the path part of uri is url-encoded now.

Requests towards uris like
will not work anymore in titanium mobile sdk 1.4.0

Following code snippet works with 1.3.0 on iOS 3.1.3 and does not work with 1.4.0 on iOS 4.0.1

        var xhrPut = Titanium.Network.createHTTPClient();
        xhrPut.onload = function()
            if (this.status===204){
                log("calling succes callback.");
                log("error loading "+this.status+" "+this.responseData);
        xhrPut.onerror = function()
            log("error loading "+this.status+" "+this.responseData);

        xhrPut.setRequestHeader('Authorization','Basic '+authstrPut);
        xhrPut.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
        xhrPut.setRequestHeader('Accept', 'application/json');

        //variables: baseuri, uri, authstrPut, params

With regards.


  1. Damien Elmes 2011-04-15

    I believe this is fixed in the latest git already.

  2. Hugo Josefson 2011-04-15

    I have this problem too in Titanium SDK 1.4.0.

    For me, it's when I do a GET like this:

       var url = 'http://www.ourdomain.com/page?Einstein=E%3Dmc2&;paramWithSlashInIt=asd%2Fasd';

    When the xhr fetches that, it becomes:


    ...because the percent characters are encoded again. For us this makes it impossible to do OAuth signed GET requests, which are vital for our application.

    I can confirm that nightly build from Aug 3 fixes the problem.

    !! Please cut a 1.4.1 release soon :) !!

    Thanks for all your hard work.

  3. Stephen Tramer 2011-04-15

    I know that this is a duplicate of a bug that either Jeff or I have fixed; we fiddled with URL encoding for a while. ',' characters are no longer escaped. Checked 1.6.0RC1.

JSON Source