PDA

View Full Version : [FIXED][3.x] Problem with XHR getReponseHeader



dirving
11 May 2009, 11:51 AM
Hi everyone,

I found what I believe to be a bug in the method createResponseObject in the ext adapter. The problem code is:



headerStr = o.conn.getAllResponseHeaders();
Ext.each(headerStr.split('\n'), function(v){
var t = v.split(':');
headerObj[t[0]] = t[1];
});
The problem that is happening is that when a header value contains a colon it does not get returned correctly. This is obviously occurring as a result of the split and following assignment. If the assignment line is changed to read:



headerStr = o.conn.getAllResponseHeaders();
Ext.each(headerStr.split('\n'), function(v){
var t = v.split(':');
headerObj[t[0]] = t.slice(1,t.length).join(':');
});
it seems to work fine.

evant
11 May 2009, 9:48 PM
Out of interest/testing can you post the response headers you were using? Thanks.

Condor
11 May 2009, 10:36 PM
It's always possible that a header value contains a colon (first example that comes to mind is the redirect location url).

I would suggest:

Ext.each(headerStr.split('\n'), function(v){
var t = v.indexOf(':');
headerObj[v.substr(0, t)] = v.substr(t + 1);
});

dirving
12 May 2009, 4:34 AM
Another example would be anything that contains date/time information (Date, Last-Modified, Expires, If-Modified-Since, etc)

evant
12 May 2009, 5:44 AM
Fixed in SVN.