]> source.dussan.org Git - jquery.git/commitdiff
(Re) Fixes #8884 in a way that keeps the format of the headers map sent to transports...
authorjaubourg <j@ubourg.net>
Tue, 19 Apr 2011 07:29:20 +0000 (00:29 -0700)
committerjaubourg <j@ubourg.net>
Tue, 19 Apr 2011 07:29:20 +0000 (00:29 -0700)
src/ajax.js
src/ajax/xhr.js

index 4f8fee6c16389975549e9eb3672f77292eeb0dcb..a16717b00add23875f256b3d189e6bf51625ac73 100644 (file)
@@ -95,7 +95,7 @@ function addToPrefiltersOrTransports( structure ) {
        };
 }
 
-//Base inspection function for prefilters and transports
+// Base inspection function for prefilters and transports
 function inspectPrefiltersOrTransports( structure, options, originalOptions, jqXHR,
                dataType /* internal */, inspected /* internal */ ) {
 
@@ -389,6 +389,7 @@ jQuery.extend({
                        ifModifiedKey,
                        // Headers (they are sent all at once)
                        requestHeaders = {},
+                       requestHeadersNames = {},
                        // Response headers
                        responseHeadersString,
                        responseHeaders,
@@ -412,7 +413,9 @@ jQuery.extend({
                                // Caches the header
                                setRequestHeader: function( name, value ) {
                                        if ( !state ) {
-                                               requestHeaders[ name.toLowerCase() ] = { n: name, v: value };
+                                               var lname = name.toLowerCase();
+                                               name = requestHeadersNames[ lname ] = requestHeadersNames[ lname ] || name;
+                                               requestHeaders[ name ] = value;
                                        }
                                        return this;
                                },
index ba4c3ec7e4c8f33a5a1e89711237c1b002b7c421..5dbc33d3fd7e7751a1ea15628993f2f2ac1c63d8 100644 (file)
@@ -104,7 +104,7 @@ if ( jQuery.support.ajax ) {
                                        // Need an extra try/catch for cross domain requests in Firefox 3
                                        try {
                                                for ( i in headers ) {
-                                                       xhr.setRequestHeader( headers[ i ].n, headers[ i ].v );
+                                                       xhr.setRequestHeader( i, headers[ i ] );
                                                }
                                        } catch( _ ) {}