Bug 696662 - HTTP Auth headers cannot be modified after http-on-modify-request. r=honzab
authorGeorg Koppen <gk@jondos.de>
Thu, 12 Jan 2012 19:07:29 -0800
changeset 85714 9c71a5a5668181529d7055640f22e10462ebe046
parent 85670 939f9467fc73abff67c7be6a75da7fb4e57dd0e5
child 85715 754c87545661b2ee5bea6ad32b3982ee9b7c07fa
push id805
push userakeybl@mozilla.com
push dateWed, 01 Feb 2012 18:17:35 +0000
treeherdermozilla-aurora@6fb3bf232436 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewershonzab
bugs696662
milestone12.0a1
Bug 696662 - HTTP Auth headers cannot be modified after http-on-modify-request. r=honzab
netwerk/protocol/http/nsHttpChannel.cpp
--- a/netwerk/protocol/http/nsHttpChannel.cpp
+++ b/netwerk/protocol/http/nsHttpChannel.cpp
@@ -323,19 +323,16 @@ nsHttpChannel::Connect(bool firstTime)
         // If we have a fallback URI (and we're not already
         // falling back), process the fallback asynchronously.
         if (!mFallbackChannel && !mFallbackKey.IsEmpty()) {
             return AsyncCall(&nsHttpChannel::HandleAsyncFallback);
         }
         return NS_ERROR_DOCUMENT_NOT_CACHED;
     }
 
-    // check to see if authorization headers should be included
-    mAuthProvider->AddAuthorizationHeaders();
-
     if (mLoadFlags & LOAD_NO_NETWORK_IO) {
         return NS_ERROR_DOCUMENT_NOT_CACHED;
     }
 
     // hit the net...
     rv = SetupTransaction();
     if (NS_FAILED(rv)) return rv;
 
@@ -3737,16 +3734,19 @@ nsHttpChannel::AsyncOpen(nsIStreamListen
     
     // Remember the cookie header that was set, if any
     const char *cookieHeader = mRequestHead.PeekHeader(nsHttp::Cookie);
     if (cookieHeader) {
         mUserSetCookieHeader = cookieHeader;
     }
 
     AddCookiesToRequest();
+ 
+    // check to see if authorization headers should be included
+    mAuthProvider->AddAuthorizationHeaders();
 
     // notify "http-on-modify-request" observers
     gHttpHandler->OnModifyRequest(this);
 
     // Adjust mCaps according to our request headers:
     //  - If "Connection: close" is set as a request header, then do not bother
     //    trying to establish a keep-alive connection.
     if (mRequestHead.HasHeaderValue(nsHttp::Connection, "close"))