diff --git a/netwerk/protocol/http/src/nsHttpChannel.cpp b/netwerk/protocol/http/src/nsHttpChannel.cpp index ff3d4427c681..ad5f96ff1366 100644 --- a/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -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 diff --git a/netwerk/protocol/http/src/nsHttpConnection.cpp b/netwerk/protocol/http/src/nsHttpConnection.cpp index 4e228eedb6cb..464f162fc97f 100644 --- a/netwerk/protocol/http/src/nsHttpConnection.cpp +++ b/netwerk/protocol/http/src/nsHttpConnection.cpp @@ -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); diff --git a/netwerk/protocol/http/src/nsHttpHeaderArray.cpp b/netwerk/protocol/http/src/nsHttpHeaderArray.cpp index 044297ebedcb..7383d58ebeca 100644 --- a/netwerk/protocol/http/src/nsHttpHeaderArray.cpp +++ b/netwerk/protocol/http/src/nsHttpHeaderArray.cpp @@ -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; iheader == nsHttp::Proxy_Authorization) || + (entry->header == nsHttp::Proxy_Connection))) + continue; buf.Append(entry->header); buf.Append(": "); buf.Append(entry->value); diff --git a/netwerk/protocol/http/src/nsHttpHeaderArray.h b/netwerk/protocol/http/src/nsHttpHeaderArray.h index e3bf5af99dea..5144b369ec09 100644 --- a/netwerk/protocol/http/src/nsHttpHeaderArray.h +++ b/netwerk/protocol/http/src/nsHttpHeaderArray.h @@ -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(); } diff --git a/netwerk/protocol/http/src/nsHttpRequestHead.cpp b/netwerk/protocol/http/src/nsHttpRequestHead.cpp index b9dbbb0b1466..b84c961aa58c 100644 --- a/netwerk/protocol/http/src/nsHttpRequestHead.cpp +++ b/netwerk/protocol/http/src/nsHttpRequestHead.cpp @@ -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); } diff --git a/netwerk/protocol/http/src/nsHttpRequestHead.h b/netwerk/protocol/http/src/nsHttpRequestHead.h index ac9331d15284..cba719bf461c 100644 --- a/netwerk/protocol/http/src/nsHttpRequestHead.h +++ b/netwerk/protocol/http/src/nsHttpRequestHead.h @@ -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; diff --git a/netwerk/protocol/http/src/nsHttpResponseHead.cpp b/netwerk/protocol/http/src/nsHttpResponseHead.cpp index f279a23c7b2e..1ca8378c3e1f 100644 --- a/netwerk/protocol/http/src/nsHttpResponseHead.cpp +++ b/netwerk/protocol/http/src/nsHttpResponseHead.cpp @@ -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; } diff --git a/netwerk/protocol/http/src/nsHttpTransaction.cpp b/netwerk/protocol/http/src/nsHttpTransaction.cpp index b8b162afa6d4..9d4ba395b005 100644 --- a/netwerk/protocol/http/src/nsHttpTransaction.cpp +++ b/netwerk/protocol/http/src/nsHttpTransaction.cpp @@ -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()) { diff --git a/netwerk/protocol/http/src/nsHttpTransaction.h b/netwerk/protocol/http/src/nsHttpTransaction.h index cfb47b237eb0..cb9f148267f0 100644 --- a/netwerk/protocol/http/src/nsHttpTransaction.h +++ b/netwerk/protocol/http/src/nsHttpTransaction.h @@ -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; }