Bug 537670 - Failure to load pages using Basic Auth and lots of content, after setting the LOAD_ANONYMOUS flag, contributed by Honza Bambas <honzab.moz@firemni.cz>, r=bz+honzab

This commit is contained in:
Philippe De Ryck 2010-01-26 14:33:03 +01:00
Родитель 5720dafe77
Коммит b64db99822
4 изменённых файлов: 24 добавлений и 5 удалений

Просмотреть файл

@ -667,10 +667,10 @@ nsHttpChannel::SetupTransaction()
NS_ADDREF(mTransaction);
// See bug #466080. Transfer LOAD_ANONYMOUS flag to socket-layer.
if (mLoadFlags & LOAD_ANONYMOUS) {
if (mLoadFlags & LOAD_ANONYMOUS)
mCaps |= NS_HTTP_LOAD_ANONYMOUS;
mConnectionInfo->SetAnonymous();
}
mConnectionInfo->SetAnonymous((mLoadFlags & LOAD_ANONYMOUS) != 0);
nsCOMPtr<nsIAsyncInputStream> responseStream;
rv = mTransaction->Init(mCaps, mConnectionInfo, &mRequestHead,

Просмотреть файл

@ -86,3 +86,16 @@ nsHttpConnectionInfo::SetOriginServer(const nsACString &host, PRInt32 port)
mHashKey.Append(')');
}
}
nsHttpConnectionInfo*
nsHttpConnectionInfo::Clone() const
{
nsHttpConnectionInfo* clone = new nsHttpConnectionInfo(mHost, mPort, mProxyInfo, mUsingSSL);
if (!clone)
return nsnull;
// Make sure the anonymous flag is transferred!
clone->SetAnonymous(mHashKey.CharAt(2) == 'A');
return clone;
}

Просмотреть файл

@ -97,6 +97,8 @@ public:
{
SetOriginServer(nsDependentCString(host), port);
}
nsHttpConnectionInfo* Clone() const;
const char *ProxyHost() const { return mProxyInfo ? mProxyInfo->Host().get() : nsnull; }
PRInt32 ProxyPort() const { return mProxyInfo ? mProxyInfo->Port() : -1; }
@ -120,7 +122,8 @@ 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); }
void SetAnonymous(PRBool anon)
{ mHashKey.SetCharAt(anon ? 'A' : '.', 2); }
private:
nsrefcnt mRef;

Просмотреть файл

@ -680,7 +680,10 @@ nsHttpConnectionMgr::ProcessNewTransaction(nsHttpTransaction *trans)
nsCStringKey key(ci->HashKey());
nsConnectionEntry *ent = (nsConnectionEntry *) mCT.Get(&key);
if (!ent) {
ent = new nsConnectionEntry(ci);
nsHttpConnectionInfo *clone = ci->Clone();
if (!clone)
return NS_ERROR_OUT_OF_MEMORY;
ent = new nsConnectionEntry(clone);
if (!ent)
return NS_ERROR_OUT_OF_MEMORY;
mCT.Put(&key, ent);