bug 570283 - dont send http proxy-connection r=jduell

This commit is contained in:
Patrick McManus 2012-09-05 08:38:01 -04:00
parent 7c58f033b0
commit 83b5dc5b17
6 changed files with 6 additions and 25 deletions

View File

@ -129,9 +129,7 @@ HttpBaseChannel::Init(nsIURI *aURI,
if (NS_FAILED(rv)) return rv;
rv = gHttpHandler->
AddStandardRequestHeaders(&mRequestHead.Headers(), aCaps,
!mConnectionInfo->UsingConnect() &&
mConnectionInfo->UsingHttpProxy());
AddStandardRequestHeaders(&mRequestHead.Headers(), aCaps);
return rv;
}

View File

@ -360,7 +360,6 @@ SpdyStream2::ParseHttpRequestHeaders(const char *buf,
name.Equals("accept-encoding") ||
name.Equals("te") ||
name.Equals("connection") ||
name.Equals("proxy-connection") ||
name.Equals("url"))
continue;

View File

@ -375,7 +375,6 @@ SpdyStream3::ParseHttpRequestHeaders(const char *buf,
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"))

View File

@ -1433,9 +1433,6 @@ nsHttpConnection::SetupProxyConnect()
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

View File

@ -332,8 +332,7 @@ nsHttpHandler::InitConnectionMgr()
nsresult
nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
uint8_t caps,
bool useProxy)
uint8_t caps)
{
nsresult rv;
@ -359,13 +358,8 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
// 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");
@ -373,9 +367,6 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
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
@ -385,9 +376,7 @@ nsHttpHandler::AddStandardRequestHeaders(nsHttpHeaderArray *request,
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

View File

@ -59,8 +59,7 @@ public:
nsresult Init();
nsresult AddStandardRequestHeaders(nsHttpHeaderArray *,
uint8_t capabilities,
bool useProxy);
uint8_t capabilities);
bool IsAcceptableEncoding(const char *encoding);
const nsAFlatCString &UserAgent();