зеркало из https://github.com/mozilla/gecko-dev.git
Proxy-authorization header incorrectly sent to server during SSL session
bug 127671 r=rpotts sr=darin a=asa
This commit is contained in:
Родитель
4ebc52c78b
Коммит
22db38cf3d
|
@ -1,3 +1,4 @@
|
|||
|
||||
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
||||
/*
|
||||
* The contents of this file are subject to the Mozilla Public
|
||||
|
@ -430,7 +431,9 @@ nsHttpChannel::SetupTransaction()
|
|||
mRequestHead.SetHeader(nsHttp::Pragma, "no-cache");
|
||||
}
|
||||
|
||||
return mTransaction->SetupRequest(&mRequestHead, mUploadStream, mUploadStreamHasHeaders);
|
||||
return mTransaction->SetupRequest(&mRequestHead, mUploadStream,
|
||||
mUploadStreamHasHeaders,
|
||||
mConnectionInfo->UsingHttpProxy() && !mConnectionInfo->UsingSSL());
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -513,7 +513,7 @@ nsHttpConnection::SetupSSLProxyConnect()
|
|||
}
|
||||
|
||||
buf.Truncate(0);
|
||||
request.Flatten(buf);
|
||||
request.Flatten(buf, PR_TRUE);
|
||||
buf.Append("\r\n");
|
||||
|
||||
rv = NS_NewCStringInputStream(getter_AddRefs(mSSLProxyConnectStream), buf);
|
||||
|
|
|
@ -159,11 +159,15 @@ nsHttpHeaderArray::ParseHeaderLine(char *line, nsHttpAtom *hdr, char **val)
|
|||
}
|
||||
|
||||
void
|
||||
nsHttpHeaderArray::Flatten(nsACString &buf)
|
||||
nsHttpHeaderArray::Flatten(nsACString &buf, PRBool pruneProxyHeaders)
|
||||
{
|
||||
PRInt32 i, count = mHeaders.Count();
|
||||
for (i=0; i<count; ++i) {
|
||||
nsEntry *entry = (nsEntry *) mHeaders[i];
|
||||
// prune proxy headers if requested
|
||||
if (pruneProxyHeaders && ((entry->header == nsHttp::Proxy_Authorization) ||
|
||||
(entry->header == nsHttp::Proxy_Connection)))
|
||||
continue;
|
||||
buf.Append(entry->header);
|
||||
buf.Append(": ");
|
||||
buf.Append(entry->value);
|
||||
|
|
|
@ -47,7 +47,7 @@ public:
|
|||
// header value (the substring of the header line -- do not free).
|
||||
void ParseHeaderLine(char *line, nsHttpAtom *header=nsnull, char **value=nsnull);
|
||||
|
||||
void Flatten(nsACString &);
|
||||
void Flatten(nsACString &, PRBool pruneProxyHeaders=PR_FALSE);
|
||||
|
||||
PRUint32 Count() { return (PRUint32) mHeaders.Count(); }
|
||||
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
|
||||
void
|
||||
nsHttpRequestHead::Flatten(nsACString &buf)
|
||||
nsHttpRequestHead::Flatten(nsACString &buf, PRBool pruneProxyHeaders)
|
||||
{
|
||||
// note: the first append is intentional.
|
||||
|
||||
|
@ -50,5 +50,5 @@ nsHttpRequestHead::Flatten(nsACString &buf)
|
|||
|
||||
buf.Append("\r\n");
|
||||
|
||||
mHeaders.Flatten(buf);
|
||||
mHeaders.Flatten(buf, pruneProxyHeaders);
|
||||
}
|
||||
|
|
|
@ -53,7 +53,7 @@ public:
|
|||
nsresult GetHeader(nsHttpAtom h, char **v) { return mHeaders.GetHeader(h, v); }
|
||||
void ClearHeaders() { mHeaders.Clear(); }
|
||||
|
||||
void Flatten(nsACString &);
|
||||
void Flatten(nsACString &, PRBool pruneProxyHeaders = PR_FALSE);
|
||||
|
||||
private:
|
||||
nsHttpHeaderArray mHeaders;
|
||||
|
|
|
@ -80,7 +80,7 @@ nsHttpResponseHead::Flatten(nsACString &buf, PRBool pruneTransients)
|
|||
buf.Append("\r\n");
|
||||
|
||||
if (!pruneTransients) {
|
||||
mHeaders.Flatten(buf);
|
||||
mHeaders.Flatten(buf, PR_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
@ -119,7 +119,8 @@ nsHttpTransaction::~nsHttpTransaction()
|
|||
nsresult
|
||||
nsHttpTransaction::SetupRequest(nsHttpRequestHead *requestHead,
|
||||
nsIInputStream *requestBody,
|
||||
PRBool requestBodyHasHeaders)
|
||||
PRBool requestBodyHasHeaders,
|
||||
PRBool pruneProxyHeaders)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -155,7 +156,7 @@ nsHttpTransaction::SetupRequest(nsHttpRequestHead *requestHead,
|
|||
mRequestHead = requestHead;
|
||||
|
||||
mReqHeaderBuf.SetLength(0);
|
||||
requestHead->Flatten(mReqHeaderBuf);
|
||||
requestHead->Flatten(mReqHeaderBuf, pruneProxyHeaders);
|
||||
|
||||
#if defined(PR_LOGGING)
|
||||
if (LOG2_ENABLED()) {
|
||||
|
|
|
@ -62,7 +62,8 @@ public:
|
|||
// Called to initialize the transaction
|
||||
nsresult SetupRequest(nsHttpRequestHead *requestHeaders,
|
||||
nsIInputStream *requestBody,
|
||||
PRBool requestBodyIncludesHeaders);
|
||||
PRBool requestBodyIncludesHeaders,
|
||||
PRBool pruneProxyHeaders);
|
||||
|
||||
nsIStreamListener *Listener() { return mListener; }
|
||||
nsAHttpConnection *Connection() { return mConnection; }
|
||||
|
|
Загрузка…
Ссылка в новой задаче