nghttpx: Disable connect protocol if forward proxy is enabled

This commit is contained in:
Tatsuhiro Tsujikawa 2018-03-13 22:42:50 +09:00
parent 19d28365e9
commit b6930e3d80
1 changed files with 13 additions and 12 deletions

View File

@ -391,7 +391,6 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
} }
} }
if (!config->http2_proxy) {
auto connect_proto = req.fs.header(http2::HD__PROTOCOL); auto connect_proto = req.fs.header(http2::HD__PROTOCOL);
if (connect_proto) { if (connect_proto) {
if (connect_proto->value != "websocket") { if (connect_proto->value != "websocket") {
@ -402,7 +401,6 @@ int Http2Upstream::on_request_headers(Downstream *downstream,
} }
req.connect_proto = CONNECT_PROTO_WEBSOCKET; req.connect_proto = CONNECT_PROTO_WEBSOCKET;
} }
}
if (!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) { if (!(frame->hd.flags & NGHTTP2_FLAG_END_STREAM)) {
req.http2_expect_body = true; req.http2_expect_body = true;
@ -1015,7 +1013,7 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
// TODO Maybe call from outside? // TODO Maybe call from outside?
std::array<nghttp2_settings_entry, 4> entry; std::array<nghttp2_settings_entry, 4> entry;
size_t nentry = 3; size_t nentry = 2;
entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS; entry[0].settings_id = NGHTTP2_SETTINGS_MAX_CONCURRENT_STREAMS;
entry[0].value = http2conf.upstream.max_concurrent_streams; entry[0].value = http2conf.upstream.max_concurrent_streams;
@ -1027,8 +1025,11 @@ Http2Upstream::Http2Upstream(ClientHandler *handler)
entry[1].value = http2conf.upstream.window_size; entry[1].value = http2conf.upstream.window_size;
} }
entry[2].settings_id = NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL; if (!config->http2_proxy) {
entry[2].value = 1; entry[nentry].settings_id = NGHTTP2_SETTINGS_ENABLE_CONNECT_PROTOCOL;
entry[nentry].value = 1;
++nentry;
}
if (http2conf.upstream.decoder_dynamic_table_size != if (http2conf.upstream.decoder_dynamic_table_size !=
NGHTTP2_DEFAULT_HEADER_TABLE_SIZE) { NGHTTP2_DEFAULT_HEADER_TABLE_SIZE) {