nghttpx: Remove host if :authority is available on HTTP2 downstream request
This commit is contained in:
parent
3c63936d3a
commit
3c57327274
|
@ -160,6 +160,7 @@ namespace {
|
||||||
const char *IGN_HD[] = {
|
const char *IGN_HD[] = {
|
||||||
"connection",
|
"connection",
|
||||||
"expect",
|
"expect",
|
||||||
|
"host",
|
||||||
"http2-settings",
|
"http2-settings",
|
||||||
"keep-alive",
|
"keep-alive",
|
||||||
"proxy-connection",
|
"proxy-connection",
|
||||||
|
|
|
@ -267,11 +267,15 @@ int Http2DownstreamConnection::push_request_headers()
|
||||||
nva.push_back(http2::make_nv_ls
|
nva.push_back(http2::make_nv_ls
|
||||||
(":authority",
|
(":authority",
|
||||||
downstream_->get_request_http2_authority()));
|
downstream_->get_request_http2_authority()));
|
||||||
} else if(downstream_->get_norm_request_header("host") == end_headers) {
|
} else {
|
||||||
if(LOG_ENABLED(INFO)) {
|
auto host = downstream_->get_norm_request_header("host");
|
||||||
DCLOG(INFO, this) << "host header field missing";
|
if(host == end_headers) {
|
||||||
|
if(LOG_ENABLED(INFO)) {
|
||||||
|
DCLOG(INFO, this) << "host header field missing";
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return -1;
|
nva.push_back(http2::make_nv_ls("host", (*host).second));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// The upstream is HTTP/1
|
// The upstream is HTTP/1
|
||||||
|
@ -318,11 +322,15 @@ int Http2DownstreamConnection::push_request_headers()
|
||||||
authority += util::utos(u.port);
|
authority += util::utos(u.port);
|
||||||
}
|
}
|
||||||
nva.push_back(http2::make_nv_ls(":authority", authority));
|
nva.push_back(http2::make_nv_ls(":authority", authority));
|
||||||
} else if(downstream_->get_norm_request_header("host") == end_headers) {
|
} else {
|
||||||
if(LOG_ENABLED(INFO)) {
|
auto host = downstream_->get_norm_request_header("host");
|
||||||
DCLOG(INFO, this) << "host header field missing";
|
if(host == end_headers) {
|
||||||
|
if(LOG_ENABLED(INFO)) {
|
||||||
|
DCLOG(INFO, this) << "host header field missing";
|
||||||
|
}
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
return -1;
|
nva.push_back(http2::make_nv_ls("host", (*host).second));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue