From 8b0bdacace9c914818905c6a9a4d398fc11ffab6 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 23 Sep 2012 21:51:53 +0900 Subject: [PATCH] Don't send Proxy-Connection header field It was deprecated long ago. --- src/HttpRequest.cc | 11 +---------- test/HttpRequestTest.cc | 6 +----- 2 files changed, 2 insertions(+), 15 deletions(-) diff --git a/src/HttpRequest.cc b/src/HttpRequest.cc index 09254d1c..837f91de 100644 --- a/src/HttpRequest.cc +++ b/src/HttpRequest.cc @@ -209,9 +209,7 @@ std::string HttpRequest::createRequest() } if(proxyRequest_) { if(request_->isKeepAliveEnabled() || request_->isPipeliningEnabled()) { - builtinHds.push_back(std::make_pair("Proxy-Connection:", "Keep-Alive")); - } else { - builtinHds.push_back(std::make_pair("Proxy-Connection:", "close")); + builtinHds.push_back(std::make_pair("Connection:", "Keep-Alive")); } } if(proxyRequest_ && !proxyRequest_->getUsername().empty()) { @@ -276,7 +274,6 @@ std::string HttpRequest::createRequest() std::string HttpRequest::createProxyRequest() const { assert(proxyRequest_); - //std::string hostport(fmt("%s:%u", getURIHost().c_str(), getPort())); std::string requestLine(fmt("CONNECT %s:%u HTTP/1.1\r\n" "User-Agent: %s\r\n" "Host: %s:%u\r\n", @@ -285,12 +282,6 @@ std::string HttpRequest::createProxyRequest() const userAgent_.c_str(), getURIHost().c_str(), getPort())); - // TODO Is "Proxy-Connection" needed here? - // if(request->isKeepAliveEnabled() || request->isPipeliningEnabled()) { - // requestLine += "Proxy-Connection: Keep-Alive\r\n"; - // }else { - // requestLine += "Proxy-Connection: close\r\n"; - // } if(!proxyRequest_->getUsername().empty()) { std::pair auth = getProxyAuthString(); requestLine += auth.first; diff --git a/test/HttpRequestTest.cc b/test/HttpRequestTest.cc index d180a06e..7091fcf3 100644 --- a/test/HttpRequestTest.cc +++ b/test/HttpRequestTest.cc @@ -271,7 +271,6 @@ void HttpRequestTest::testCreateRequest() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Proxy-Connection: close\r\n" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "\r\n"; @@ -287,7 +286,7 @@ void HttpRequestTest::testCreateRequest() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Range: bytes=0-1048575\r\n" - "Proxy-Connection: Keep-Alive\r\n" + "Connection: Keep-Alive\r\n" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "\r\n"; @@ -306,7 +305,6 @@ void HttpRequestTest::testCreateRequest() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Proxy-Connection: close\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "\r\n"; @@ -347,7 +345,6 @@ void HttpRequestTest::testCreateRequest_ftp() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Proxy-Connection: close\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "\r\n"; @@ -366,7 +363,6 @@ void HttpRequestTest::testCreateRequest_ftp() "Pragma: no-cache\r\n" "Cache-Control: no-cache\r\n" "Connection: close\r\n" - "Proxy-Connection: close\r\n" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "\r\n";