Skip to content

Commit

Permalink
Fix for #273 Firefox Bug: getAllResponseHeaders() returns empty String
Browse files Browse the repository at this point in the history
  • Loading branch information
jfarcand committed Apr 10, 2012
1 parent 431b6b2 commit 3fe52d8
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion modules/jquery/src/main/webapp/jquery/jquery.atmosphere.js
Original file line number Diff line number Diff line change
Expand Up @@ -765,6 +765,16 @@ jQuery.atmosphere = function() {
try {
_response.status = ajaxRequest.status;
_response.headers = parseHeaders(ajaxRequest.getAllResponseHeaders());

// HOTFIX for firefox bug: https://bugzilla.mozilla.org/show_bug.cgi?id=608735
if (_request.headers) {
jQuery.each(_request.headers, function(name) {
var v = ajaxRequest.getResponseHeader(name);
if (v) {
_response.headers[name] = v;
}
});
}
}
catch(e) {
_response.status = 404;
Expand Down Expand Up @@ -888,7 +898,7 @@ jQuery.atmosphere = function() {
ajaxRequest.setRequestHeader("X-Atmosphere-tracking-id", _uuid);

jQuery.each(request.headers, function(name, value) {
var h = jQuery.isFunction(value) ? value.call(this, ajaxRequest, request, create) : value;
var h = jQuery.isFunction(value) ? value.call(this, ajaxRequest, request, create, _response) : value;
if (h) {
ajaxRequest.setRequestHeader(name, h);
}
Expand Down

0 comments on commit 3fe52d8

Please sign in to comment.