diff --git a/src/http2.cc b/src/http2.cc index b674042e..5289ef5c 100644 --- a/src/http2.cc +++ b/src/http2.cc @@ -160,7 +160,6 @@ namespace { const char *IGN_HD[] = { "connection", "expect", - "host", "http2-settings", "keep-alive", "proxy-connection", diff --git a/src/shrpx_http2_downstream_connection.cc b/src/shrpx_http2_downstream_connection.cc index 76d8592b..04becdf2 100644 --- a/src/shrpx_http2_downstream_connection.cc +++ b/src/shrpx_http2_downstream_connection.cc @@ -267,15 +267,11 @@ int Http2DownstreamConnection::push_request_headers() nva.push_back(http2::make_nv_ls (":authority", downstream_->get_request_http2_authority())); - } else { - auto host = downstream_->get_norm_request_header("host"); - if(host == end_headers) { - if(LOG_ENABLED(INFO)) { - DCLOG(INFO, this) << "host header field missing"; - } - return -1; + } else if(downstream_->get_norm_request_header("host") == end_headers) { + if(LOG_ENABLED(INFO)) { + DCLOG(INFO, this) << "host header field missing"; } - nva.push_back(http2::make_nv_ls("host", (*host).second)); + return -1; } } else { // The upstream is HTTP/1 @@ -322,15 +318,11 @@ int Http2DownstreamConnection::push_request_headers() authority += util::utos(u.port); } nva.push_back(http2::make_nv_ls(":authority", authority)); - } else { - auto host = downstream_->get_norm_request_header("host"); - if(host == end_headers) { - if(LOG_ENABLED(INFO)) { - DCLOG(INFO, this) << "host header field missing"; - } - return -1; + } else if(downstream_->get_norm_request_header("host") == end_headers) { + if(LOG_ENABLED(INFO)) { + DCLOG(INFO, this) << "host header field missing"; } - nva.push_back(http2::make_nv_ls("host", (*host).second)); + return -1; } }