bug 570283 - dont send http proxy-connection r=jduell
authorPatrick McManus <mcmanus@ducksong.com>
Wed, 05 Sep 2012 08:38:01 -0400
changeset 104289 d28039477b6d9b86074e45ac02c8ca62be7f8165
parent 104288 49cdfadd5aefc3f82bbad1a5a4c5d11ecab89d38
child 104290 1181826ded9c03794c2a444875e2b95e7a109eb9
push id23417
push userryanvm@gmail.com
push dateThu, 06 Sep 2012 02:27:31 +0000
treeherdermozilla-central@501f4e46a88c [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjduell
bugs570283
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
bug 570283 - dont send http proxy-connection r=jduell
netwerk/protocol/http/HttpBaseChannel.cpp
netwerk/protocol/http/SpdyStream2.cpp
netwerk/protocol/http/SpdyStream3.cpp
netwerk/protocol/http/nsHttpConnection.cpp
netwerk/protocol/http/nsHttpHandler.cpp
netwerk/protocol/http/nsHttpHandler.h
--- a/netwerk/protocol/http/HttpBaseChannel.cpp
+++ b/netwerk/protocol/http/HttpBaseChannel.cpp
@@ -124,19 +124,17 @@ HttpBaseChannel::Init(nsIURI *aURI,
   nsAutoCString hostLine;
   rv = nsHttpHandler::GenerateHostPort(host, port, hostLine);
   if (NS_FAILED(rv)) return rv;
 
   rv = mRequestHead.SetHeader(nsHttp::Host, hostLine);
   if (NS_FAILED(rv)) return rv;
 
   rv = gHttpHandler->
-      AddStandardRequestHeaders(&mRequestHead.Headers(), aCaps,
-                                !mConnectionInfo->UsingConnect() &&
-                                mConnectionInfo->UsingHttpProxy());
+    AddStandardRequestHeaders(&mRequestHead.Headers(), aCaps);
 
   return rv;
 }
 
 //-----------------------------------------------------------------------------
 // HttpBaseChannel::nsISupports
 //-----------------------------------------------------------------------------
 
--- a/netwerk/protocol/http/SpdyStream2.cpp
+++ b/netwerk/protocol/http/SpdyStream2.cpp
@@ -355,17 +355,16 @@ SpdyStream2::ParseHttpRequestHeaders(con
 
     if (name.Equals("method") ||
         name.Equals("version") ||
         name.Equals("scheme") ||
         name.Equals("keep-alive") ||
         name.Equals("accept-encoding") ||
         name.Equals("te") ||
         name.Equals("connection") ||
-        name.Equals("proxy-connection") ||
         name.Equals("url"))
       continue;
     
     nsCString *val = hdrHash.Get(name);
     if (!val) {
       val = new nsCString();
       hdrHash.Put(name, val);
     }
--- a/netwerk/protocol/http/SpdyStream3.cpp
+++ b/netwerk/protocol/http/SpdyStream3.cpp
@@ -370,17 +370,16 @@ SpdyStream3::ParseHttpRequestHeaders(con
                                            beginBuffer + colonIndex);
     // all header names are lower case in spdy
     ToLowerCase(name);
 
     // exclusions.. mostly from 3.2.1
     if (name.Equals("connection") ||
         name.Equals("keep-alive") ||
         name.Equals("host") ||
-        name.Equals("proxy-connection") ||
         name.Equals("accept-encoding") ||
         name.Equals("te") ||
         name.Equals("transfer-encoding"))
       continue;
 
     nsCString *val = hdrHash.Get(name);
     if (!val) {
       val = new nsCString();
--- a/netwerk/protocol/http/nsHttpConnection.cpp
+++ b/netwerk/protocol/http/nsHttpConnection.cpp
@@ -1428,19 +1428,16 @@ nsHttpConnection::SetupProxyConnect()
 
     // CONNECT host:port HTTP/1.1
     nsHttpRequestHead request;
     request.SetMethod(nsHttp::Connect);
     request.SetVersion(gHttpHandler->HttpVersion());
     request.SetRequestURI(buf);
     request.SetHeader(nsHttp::User_Agent, gHttpHandler->UserAgent());
 
-    // send this header for backwards compatibility.
-    request.SetHeader(nsHttp::Proxy_Connection, NS_LITERAL_CSTRING("keep-alive"));
-
     val = mTransaction->RequestHead()->PeekHeader(nsHttp::Host);
     if (val) {
         // all HTTP/1.1 requests must include a Host header (even though it
         // may seem redundant in this case; see bug 82388).
         request.SetHeader(nsHttp::Host, nsDependentCString(val));
     }
 
     val = mTransaction->RequestHead()->PeekHeader(nsHttp::Proxy_Authorization);
--- a/netwerk/protocol/http/nsHttpHandler.cpp
+++ b/netwerk/protocol/http/nsHttpHandler.cpp
@@ -327,18 +327,17 @@ nsHttpHandler::InitConnectionMgr()
                         mMaxRequestDelay,
                         mMaxPipelinedRequests,
                         mMaxOptimisticPipelinedRequests);
     return rv;
 }
 
 nsresult
 nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
-                                         uint8_t caps,
-                                         bool useProxy)
+                                         uint8_t caps)
 {
     nsresult rv;
 
     // Add the "User-Agent" header
     rv = request->SetHeader(nsHttp::User_Agent, UserAgent());
     if (NS_FAILED(rv)) return rv;
 
     // MIME based content negotiation lives!
@@ -354,45 +353,35 @@ nsHttpHandler::AddStandardRequestHeaders
     }
 
     // Add the "Accept-Encoding" header
     rv = request->SetHeader(nsHttp::Accept_Encoding, mAcceptEncodings);
     if (NS_FAILED(rv)) return rv;
 
     // RFC2616 section 19.6.2 states that the "Connection: keep-alive"
     // and "Keep-alive" request headers should not be sent by HTTP/1.1
-    // user-agents.  Otherwise, problems with proxy servers (especially
-    // transparent proxies) can result.
-    //
-    // However, we need to send something so that we can use keepalive
-    // with HTTP/1.0 servers/proxies. We use "Proxy-Connection:" when
-    // we're talking to an http proxy, and "Connection:" otherwise.
-    // We no longer send the Keep-Alive request header.
+    // user-agents.  But this is not a problem in practice, and the
+    // alternative proxy-connection is worse. see 570283
 
     NS_NAMED_LITERAL_CSTRING(close, "close");
     NS_NAMED_LITERAL_CSTRING(keepAlive, "keep-alive");
 
     const nsACString *connectionType = &close;
     if (caps & NS_HTTP_ALLOW_KEEPALIVE) {
         connectionType = &keepAlive;
-    } else if (useProxy) {
-        // Bug 92006
-        request->SetHeader(nsHttp::Connection, close);
     }
 
     // Add the "Do-Not-Track" header
     if (mDoNotTrackEnabled) {
       rv = request->SetHeader(nsHttp::DoNotTrack,
                               NS_LITERAL_CSTRING("1"));
       if (NS_FAILED(rv)) return rv;
     }
 
-    const nsHttpAtom &header = useProxy ? nsHttp::Proxy_Connection
-                                        : nsHttp::Connection;
-    return request->SetHeader(header, *connectionType);
+    return request->SetHeader(nsHttp::Connection, *connectionType);
 }
 
 bool
 nsHttpHandler::IsAcceptableEncoding(const char *enc)
 {
     if (!enc)
         return false;
 
--- a/netwerk/protocol/http/nsHttpHandler.h
+++ b/netwerk/protocol/http/nsHttpHandler.h
@@ -54,18 +54,17 @@ public:
     NS_DECL_NSIOBSERVER
     NS_DECL_NSISPECULATIVECONNECT
 
     nsHttpHandler();
     virtual ~nsHttpHandler();
 
     nsresult Init();
     nsresult AddStandardRequestHeaders(nsHttpHeaderArray *,
-                                       uint8_t capabilities,
-                                       bool useProxy);
+                                       uint8_t capabilities);
     bool     IsAcceptableEncoding(const char *encoding);
 
     const nsAFlatCString &UserAgent();
 
     nsHttpVersion  HttpVersion()             { return mHttpVersion; }
     nsHttpVersion  ProxyHttpVersion()        { return mProxyHttpVersion; }
     uint8_t        ReferrerLevel()           { return mReferrerLevel; }
     bool           SendSecureXSiteReferrer() { return mSendSecureXSiteReferrer; }