nghttpx: Refactor a bit
This commit is contained in:
parent
f418d1239f
commit
8aab74ad36
|
@ -251,6 +251,9 @@ int HttpDownstreamConnection::push_request_headers() {
|
||||||
// Assume that method and request path do not contain \r\n.
|
// Assume that method and request path do not contain \r\n.
|
||||||
std::string hdrs = http2::to_method_string(downstream_->get_request_method());
|
std::string hdrs = http2::to_method_string(downstream_->get_request_method());
|
||||||
hdrs += ' ';
|
hdrs += ' ';
|
||||||
|
|
||||||
|
auto &scheme = downstream_->get_request_http2_scheme();
|
||||||
|
|
||||||
if (connect_method) {
|
if (connect_method) {
|
||||||
if (authority) {
|
if (authority) {
|
||||||
hdrs += authority;
|
hdrs += authority;
|
||||||
|
@ -260,8 +263,8 @@ int HttpDownstreamConnection::push_request_headers() {
|
||||||
} else if (get_config()->http2_proxy || get_config()->client_proxy) {
|
} else if (get_config()->http2_proxy || get_config()->client_proxy) {
|
||||||
// Construct absolute-form request target because we are going to
|
// Construct absolute-form request target because we are going to
|
||||||
// send a request to a HTTP/1 proxy.
|
// send a request to a HTTP/1 proxy.
|
||||||
assert(!downstream_->get_request_http2_scheme().empty());
|
assert(!scheme.empty());
|
||||||
hdrs += downstream_->get_request_http2_scheme();
|
hdrs += scheme;
|
||||||
hdrs += "://";
|
hdrs += "://";
|
||||||
|
|
||||||
if (authority) {
|
if (authority) {
|
||||||
|
@ -344,8 +347,8 @@ int HttpDownstreamConnection::push_request_headers() {
|
||||||
if (!get_config()->http2_proxy && !get_config()->client_proxy &&
|
if (!get_config()->http2_proxy && !get_config()->client_proxy &&
|
||||||
!connect_method) {
|
!connect_method) {
|
||||||
hdrs += "X-Forwarded-Proto: ";
|
hdrs += "X-Forwarded-Proto: ";
|
||||||
assert(!downstream_->get_request_http2_scheme().empty());
|
assert(!scheme.empty());
|
||||||
hdrs += downstream_->get_request_http2_scheme();
|
hdrs += scheme;
|
||||||
hdrs += "\r\n";
|
hdrs += "\r\n";
|
||||||
}
|
}
|
||||||
auto via = downstream_->get_request_header(http2::HD_VIA);
|
auto via = downstream_->get_request_header(http2::HD_VIA);
|
||||||
|
|
Loading…
Reference in New Issue