Ver Fonte

Don't send Proxy-Connection header field

It was deprecated long ago.
Tatsuhiro Tsujikawa há 13 anos atrás
pai
commit
8b0bdacace
2 ficheiros alterados com 2 adições e 15 exclusões
  1. 1 10
      src/HttpRequest.cc
  2. 1 5
      test/HttpRequestTest.cc

+ 1 - 10
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<std::string, std::string> auth = getProxyAuthString();
     requestLine += auth.first;

+ 1 - 5
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";