From 399c38fb115f8a5bf2b473f195a06b09dcafaa63 Mon Sep 17 00:00:00 2001 From: "darin%meer.net" Date: Wed, 8 Feb 2006 17:40:35 +0000 Subject: [PATCH] fixes bug 321999 "HTTP waits for response to determine keep-alive state" r=biesi sr+a=bzbarsky git-svn-id: svn://10.0.0.236/branches/MOZILLA_1_8_BRANCH@189423 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp index f382bcbadd9..43ae094121c 100644 --- a/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp +++ b/mozilla/netwerk/protocol/http/src/nsHttpChannel.cpp @@ -3357,7 +3357,7 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context) return rv; // Remember the cookie header that was set, if any - const char* cookieHeader = mRequestHead.PeekHeader(nsHttp::Cookie); + const char *cookieHeader = mRequestHead.PeekHeader(nsHttp::Cookie); if (cookieHeader) mUserSetCookieHeader = cookieHeader; @@ -3366,6 +3366,13 @@ nsHttpChannel::AsyncOpen(nsIStreamListener *listener, nsISupports *context) // notify "http-on-modify-request" observers gHttpHandler->OnModifyRequest(this); + + // Adjust mCaps according to our request headers: + // - If "Connection: close" is set as a request header, then do not bother + // trying to establish a keep-alive connection. + const char *connHeader = mRequestHead.PeekHeader(nsHttp::Connection); + if (PL_strcasestr(connHeader, "close")) + mCaps &= ~(NS_HTTP_ALLOW_KEEPALIVE | NS_HTTP_ALLOW_PIPELINING); mIsPending = PR_TRUE;