Don't send Proxy-Connection header field

It was deprecated long ago.
pull/28/head
Tatsuhiro Tsujikawa 2012-09-23 21:51:53 +09:00
parent 54665ff409
commit 8b0bdacace
2 changed files with 2 additions and 15 deletions

View File

@ -209,9 +209,7 @@ std::string HttpRequest::createRequest()
} }
if(proxyRequest_) { if(proxyRequest_) {
if(request_->isKeepAliveEnabled() || request_->isPipeliningEnabled()) { if(request_->isKeepAliveEnabled() || request_->isPipeliningEnabled()) {
builtinHds.push_back(std::make_pair("Proxy-Connection:", "Keep-Alive")); builtinHds.push_back(std::make_pair("Connection:", "Keep-Alive"));
} else {
builtinHds.push_back(std::make_pair("Proxy-Connection:", "close"));
} }
} }
if(proxyRequest_ && !proxyRequest_->getUsername().empty()) { if(proxyRequest_ && !proxyRequest_->getUsername().empty()) {
@ -276,7 +274,6 @@ std::string HttpRequest::createRequest()
std::string HttpRequest::createProxyRequest() const std::string HttpRequest::createProxyRequest() const
{ {
assert(proxyRequest_); assert(proxyRequest_);
//std::string hostport(fmt("%s:%u", getURIHost().c_str(), getPort()));
std::string requestLine(fmt("CONNECT %s:%u HTTP/1.1\r\n" std::string requestLine(fmt("CONNECT %s:%u HTTP/1.1\r\n"
"User-Agent: %s\r\n" "User-Agent: %s\r\n"
"Host: %s:%u\r\n", "Host: %s:%u\r\n",
@ -285,12 +282,6 @@ std::string HttpRequest::createProxyRequest() const
userAgent_.c_str(), userAgent_.c_str(),
getURIHost().c_str(), getURIHost().c_str(),
getPort())); 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()) { if(!proxyRequest_->getUsername().empty()) {
std::pair<std::string, std::string> auth = getProxyAuthString(); std::pair<std::string, std::string> auth = getProxyAuthString();
requestLine += auth.first; requestLine += auth.first;

View File

@ -271,7 +271,6 @@ void HttpRequestTest::testCreateRequest()
"Pragma: no-cache\r\n" "Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n" "Cache-Control: no-cache\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"Proxy-Connection: close\r\n"
"Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
"Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
"\r\n"; "\r\n";
@ -287,7 +286,7 @@ void HttpRequestTest::testCreateRequest()
"Pragma: no-cache\r\n" "Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n" "Cache-Control: no-cache\r\n"
"Range: bytes=0-1048575\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" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
"Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
"\r\n"; "\r\n";
@ -306,7 +305,6 @@ void HttpRequestTest::testCreateRequest()
"Pragma: no-cache\r\n" "Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n" "Cache-Control: no-cache\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"Proxy-Connection: close\r\n"
"Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
"\r\n"; "\r\n";
@ -347,7 +345,6 @@ void HttpRequestTest::testCreateRequest_ftp()
"Pragma: no-cache\r\n" "Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n" "Cache-Control: no-cache\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"Proxy-Connection: close\r\n"
"Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
"\r\n"; "\r\n";
@ -366,7 +363,6 @@ void HttpRequestTest::testCreateRequest_ftp()
"Pragma: no-cache\r\n" "Pragma: no-cache\r\n"
"Cache-Control: no-cache\r\n" "Cache-Control: no-cache\r\n"
"Connection: close\r\n" "Connection: close\r\n"
"Proxy-Connection: close\r\n"
"Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n" "Proxy-Authorization: Basic YXJpYTJwcm94eXVzZXI6YXJpYTJwcm94eXBhc3N3ZA==\r\n"
"Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n" "Authorization: Basic YXJpYTJ1c2VyOmFyaWEycGFzc3dk\r\n"
"\r\n"; "\r\n";