metajack / strophejs

The Strophe.js repository has moved to https://github.com/strophe/strophejs

Home Page:http://strophe.im/strophejs

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

"XHR open failed." in BOSH in IE9 with v1.2.8

wk3368 opened this issue · comments

LOG: 23:30:52:123 0 _throttledRequestHandler called with 1 requests 
LOG: 23:30:52:125 0 request id 1.0 posting 
LOG: 23:30:52:126 3 XHR open failed. 

but v1.2.2 works fine .

I have compared the code between v1.2.2 and v1.2.8

v1.2.2

try {
    req.xhr.open("POST", this._conn.service, this._conn.options.sync ? false : true);
    req.xhr.setRequestHeader && req.xhr.setRequestHeader("Content-Type", "text/xml; charset=utf-8");
}

v1.2.8

try {
    var contentType = this._conn.options.contentType || "text/xml; charset=utf-8";    
    req.xhr.open("POST", this._conn.service, this._conn.options.sync ? false : true);    
    req.xhr.setRequestHeader("Content-Type", contentType);    
    if (this._conn.options.withCredentials) {
        req.xhr.withCredentials = true;
    }
}

so I try to change this line in v1.2.8:

 req.xhr.setRequestHeader("Content-Type", contentType); 

to

req.xhr.setRequestHeader && req.xhr.setRequestHeader("Content-Type", contentType); 

and it works fine!

I think this is a bug!