From 84172753685abb74a5bb49930ec8c72a7b1899d8 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 24 Feb 2015 15:11:09 +0900 Subject: [PATCH] nghttpx: Code cleanup --- src/shrpx_http2_upstream.cc | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index dc131898..8bbfe1df 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -250,16 +250,12 @@ int on_request_headers(Http2Upstream *upstream, Downstream *downstream, auto method = downstream->get_request_header(http2::HD__METHOD); auto scheme = downstream->get_request_header(http2::HD__SCHEME); - bool is_connect = "CONNECT" == method->value; - bool having_authority = http2::non_empty_value(authority); - // presence of mandatory header fields are guaranteed by libnghttp2. - if (!is_connect) { - // For HTTP/2 proxy, :authority is required. - if (get_config()->http2_proxy && !having_authority) { - upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); - return 0; - } + + // For HTTP/2 proxy, we request :authority. + if (method->value != "CONNECT" && get_config()->http2_proxy && !authority) { + upstream->rst_stream(downstream, NGHTTP2_PROTOCOL_ERROR); + return 0; } downstream->set_request_method(http2::value_to_str(method));