Fixes #8297. Makes sure response headers with empty values are handled properly and...
[jquery.git] / src / ajax.js
index 76a2dc8..6414e8c 100644 (file)
@@ -4,7 +4,7 @@ var r20 = /%20/g,
        rbracket = /\[\]$/,
        rCRLF = /\r?\n/g,
        rhash = /#.*$/,
-       rheaders = /^(.*?):\s*(.*?)\r?$/mg, // IE leaves an \r character at EOL
+       rheaders = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, // IE leaves an \r character at EOL
        rinput = /^(?:color|date|datetime|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,
        // #7653, #8125, #8152: local protocol detection
        rlocalProtocol = /(?:^file|^widget|\-extension):$/,
@@ -439,7 +439,7 @@ jQuery.extend({
                                                }
                                                match = responseHeaders[ key.toLowerCase() ];
                                        }
-                                       return match || null;
+                                       return match === undefined ? null : match;
                                },
 
                                // Overrides response content-type header