Commit 8aab74ad authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Refactor a bit

parent f418d123
......@@ -251,6 +251,9 @@ int HttpDownstreamConnection::push_request_headers() {
// Assume that method and request path do not contain \r\n.
std::string hdrs = http2::to_method_string(downstream_->get_request_method());
hdrs += ' ';
auto &scheme = downstream_->get_request_http2_scheme();
if (connect_method) {
if (authority) {
hdrs += authority;
......@@ -260,8 +263,8 @@ int HttpDownstreamConnection::push_request_headers() {
} else if (get_config()->http2_proxy || get_config()->client_proxy) {
// Construct absolute-form request target because we are going to
// send a request to a HTTP/1 proxy.
assert(!downstream_->get_request_http2_scheme().empty());
hdrs += downstream_->get_request_http2_scheme();
assert(!scheme.empty());
hdrs += scheme;
hdrs += "://";
if (authority) {
......@@ -344,8 +347,8 @@ int HttpDownstreamConnection::push_request_headers() {
if (!get_config()->http2_proxy && !get_config()->client_proxy &&
!connect_method) {
hdrs += "X-Forwarded-Proto: ";
assert(!downstream_->get_request_http2_scheme().empty());
hdrs += downstream_->get_request_http2_scheme();
assert(!scheme.empty());
hdrs += scheme;
hdrs += "\r\n";
}
auto via = downstream_->get_request_header(http2::HD_VIA);
......
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