Bug 474038 - Don't reuse keep-alive connections for both anonymous and non-anonymous requests; r=(cbiesinger + jonas) sr=jonas

This commit is contained in:
Honza Bambas 2009-02-26 18:43:45 +01:00
parent f65cc1e89b
commit 7e1b0db13a
3 changed files with 7 additions and 2 deletions

View File

@ -676,6 +676,7 @@ nsHttpChannel::SetupTransaction()
// See bug #466080. Transfer LOAD_ANONYMOUS flag to socket-layer.
if (mLoadFlags & LOAD_ANONYMOUS) {
mCaps |= NS_HTTP_LOAD_ANONYMOUS;
mConnectionInfo->SetAnonymous();
}
nsCOMPtr<nsIAsyncInputStream> responseStream;

View File

@ -49,7 +49,10 @@ nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port)
// build hash key:
//
// the hash key uniquely identifies the connection type. two connections
// are "equal" if they end up talking the same protocol to the same server.
// are "equal" if they end up talking the same protocol to the same server
// and are both used for anonymous or non-anonymous connection only;
// anonymity of the connection is setup later from nsHttpChannel::AsyncOpen
// where we know we use anonymous connection (LOAD_ANONYMOUS load flag)
//
const char *keyHost;
@ -64,7 +67,7 @@ nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port)
keyPort = Port();
}
mHashKey.AssignLiteral("..");
mHashKey.AssignLiteral("...");
mHashKey.Append(keyHost);
mHashKey.Append(':');
mHashKey.AppendInt(keyPort);

View File

@ -120,6 +120,7 @@ public:
PRBool UsingHttpProxy() const { return mUsingHttpProxy; }
PRBool UsingSSL() const { return mUsingSSL; }
PRInt32 DefaultPort() const { return mUsingSSL ? NS_HTTPS_DEFAULT_PORT : NS_HTTP_DEFAULT_PORT; }
void SetAnonymous() { mHashKey.SetCharAt('A', 2); }
private:
nsrefcnt mRef;