Commit 7b904040 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Omit well-known port from hostport in downstream request

parent de0543f6
......@@ -506,6 +506,10 @@ int Http2Session::downstream_connect_proxy() {
std::string req = "CONNECT ";
req += downstream_addr.hostport.get();
if (downstream_addr.port == 80 || downstream_addr.port == 443) {
req += ":";
req += util::utos(downstream_addr.port);
}
req += " HTTP/1.1\r\nHost: ";
req += downstream_addr.host.get();
req += "\r\n";
......
......@@ -1038,8 +1038,10 @@ std::string make_hostport(const char *host, uint16_t port) {
hostport += "]";
}
if (port != 80 && port != 443) {
hostport += ":";
hostport += utos(port);
}
return hostport;
}
......
......@@ -609,7 +609,7 @@ std::string format_duration(const std::chrono::microseconds &u);
// Creates "host:port" string using given |host| and |port|. If
// |host| is numeric IPv6 address (e.g., ::1), it is enclosed by "["
// and "]".
// and "]". If |port| is 80 or 443, port part is omitted.
std::string make_hostport(const char *host, uint16_t port);
} // namespace util
......
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