Commit 5594f0ef authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Preserve upgrade in Connection header field

parent 8fd1953b
...@@ -118,7 +118,7 @@ int HttpDownstreamConnection::push_request_headers() ...@@ -118,7 +118,7 @@ int HttpDownstreamConnection::push_request_headers()
hdrs += downstream_->get_request_path(); hdrs += downstream_->get_request_path();
hdrs += " "; hdrs += " ";
hdrs += "HTTP/1.1\r\n"; hdrs += "HTTP/1.1\r\n";
bool connection_upgrade = false; std::string connection_upgrade;
std::string via_value; std::string via_value;
std::string xff_value; std::string xff_value;
const Headers& request_headers = downstream_->get_request_headers(); const Headers& request_headers = downstream_->get_request_headers();
...@@ -126,8 +126,9 @@ int HttpDownstreamConnection::push_request_headers() ...@@ -126,8 +126,9 @@ int HttpDownstreamConnection::push_request_headers()
i != request_headers.end(); ++i) { i != request_headers.end(); ++i) {
if(util::strieq((*i).first.c_str(), "connection")) { if(util::strieq((*i).first.c_str(), "connection")) {
if(util::strifind((*i).second.c_str(), "upgrade")) { if(util::strifind((*i).second.c_str(), "upgrade")) {
connection_upgrade = true; connection_upgrade = (*i).second;
} }
continue;
} else if(util::strieq((*i).first.c_str(), "x-forwarded-proto") || } else if(util::strieq((*i).first.c_str(), "x-forwarded-proto") ||
util::strieq((*i).first.c_str(), "keep-alive") || util::strieq((*i).first.c_str(), "keep-alive") ||
util::strieq((*i).first.c_str(), "proxy-connection")) { util::strieq((*i).first.c_str(), "proxy-connection")) {
...@@ -153,8 +154,10 @@ int HttpDownstreamConnection::push_request_headers() ...@@ -153,8 +154,10 @@ int HttpDownstreamConnection::push_request_headers()
} }
if(downstream_->get_request_connection_close()) { if(downstream_->get_request_connection_close()) {
hdrs += "Connection: close\r\n"; hdrs += "Connection: close\r\n";
} else if(connection_upgrade) { } else if(!connection_upgrade.empty()) {
hdrs += "Connection: upgrade\r\n"; hdrs += "Connection: ";
hdrs += connection_upgrade;
hdrs += "\r\n";
} }
if(get_config()->add_x_forwarded_for) { if(get_config()->add_x_forwarded_for) {
hdrs += "X-Forwarded-For: "; hdrs += "X-Forwarded-For: ";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment