[TIMOB-1461] HTTP PUT method fails with SDK 1.4.0 due to url-encoded path
GitHub Issue | n/a |
---|---|
Type | Bug |
Priority | Trivial |
Status | Closed |
Resolution | Fixed |
Resolution Date | 2011-04-17T01:56:14.000+0000 |
Affected Version/s | n/a |
Fix Version/s | n/a |
Components | iOS |
Labels | encoded, encoding, get, httpclient, ios, method, percent, put, url |
Reporter | Martin Lasak |
Assignee | Jeff Haynie |
Created | 2011-04-15T02:53:28.000+0000 |
Updated | 2011-04-17T01:56:14.000+0000 |
Description
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
http://www.ourdomain.com/our,comma,separated,path/">http://www.ourdomain.com/our,comma,separated,path/
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.");
}else{
log("error loading "+this.status+" "+this.responseData);
}
};
xhrPut.onerror = function()
{
log("error loading "+this.status+" "+this.responseData);
};
xhrPut.open("PUT",baseuri+uri);
xhrPut.setRequestHeader('Authorization','Basic '+authstrPut);
xhrPut.setRequestHeader('Content-Type', 'application/json; charset=utf-8');
xhrPut.setRequestHeader('Accept', 'application/json');
xhrPut.send(JSON.stringify(params));
//variables: baseuri, uri, authstrPut, params
With regards.
I believe this is fixed in the latest git already.
I have this problem too in Titanium SDK 1.4.0.
For me, it's when I do a GET like this:
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.
/Hugo
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.