bug 654201 - an idle persistent connection could be run with the wrong security callbacks r=honzab
authorPatrick McManus <mcmanus@ducksong.com>
Fri, 13 May 2011 13:28:30 -0700
changeset 69508 6d0e02e42e34843202ec2af7a905fe2a021b8a8e
parent 69507 9f962c272ef05752b6b9253228d8d6da42e599c9
child 69509 181536b14bd298573271435a04a90d654f03ff07
push idunknown
push userunknown
push dateunknown
reviewershonzab
bugs654201
milestone6.0a1
bug 654201 - an idle persistent connection could be run with the wrong security callbacks r=honzab
netwerk/protocol/http/nsHttpConnection.cpp
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -145,16 +145,28 @@ nsHttpConnection::Activate(nsAHttpTransa
 
     NS_ABORT_IF_FALSE(PR_GetCurrentThread() == gSocketThread, "wrong thread");
     LOG(("nsHttpConnection::Activate [this=%x trans=%x caps=%x]\n",
          this, trans, caps));
 
     NS_ENSURE_ARG_POINTER(trans);
     NS_ENSURE_TRUE(!mTransaction, NS_ERROR_IN_PROGRESS);
 
+    // Update security callbacks
+    nsCOMPtr<nsIInterfaceRequestor> callbacks;
+    nsCOMPtr<nsIEventTarget>        callbackTarget;
+    trans->GetSecurityCallbacks(getter_AddRefs(callbacks),
+                                getter_AddRefs(callbackTarget));
+    if (callbacks != mCallbacks) {
+        mCallbacks.swap(callbacks);
+        if (callbacks)
+            NS_ProxyRelease(mCallbackTarget, callbacks);
+        mCallbackTarget = callbackTarget;
+    }
+
     // take ownership of the transaction
     mTransaction = trans;
 
     // set mKeepAlive according to what will be requested
     mKeepAliveMask = mKeepAlive = (caps & NS_HTTP_ALLOW_KEEPALIVE);
 
     // need to handle SSL proxy CONNECT if this is the first time.
     if (mConnInfo->UsingSSL() && mConnInfo->UsingHttpProxy() && !mCompletedSSLConnect) {