nghttpx: Don't upgrade to HTTP/2 if we have non-final HTTP/1 response pending
This commit is contained in:
parent
5fdb36239a
commit
7e51a87111
|
@ -348,6 +348,11 @@ int htp_msg_completecb(http_parser *htp) {
|
||||||
|
|
||||||
if (handler->get_http2_upgrade_allowed() &&
|
if (handler->get_http2_upgrade_allowed() &&
|
||||||
downstream->get_http2_upgrade_request() &&
|
downstream->get_http2_upgrade_request() &&
|
||||||
|
// we may write non-final header in response_buf, in this case,
|
||||||
|
// response_state is still INITIAL. So don't upgrade in this
|
||||||
|
// case, otherwise we end up send this non-final header as
|
||||||
|
// response body in HTTP/2 upstream.
|
||||||
|
downstream->get_response_buf()->rleft() == 0 &&
|
||||||
handler->perform_http2_upgrade(upstream) != 0) {
|
handler->perform_http2_upgrade(upstream) != 0) {
|
||||||
if (LOG_ENABLED(INFO)) {
|
if (LOG_ENABLED(INFO)) {
|
||||||
ULOG(INFO, upstream) << "HTTP Upgrade to HTTP/2 failed";
|
ULOG(INFO, upstream) << "HTTP Upgrade to HTTP/2 failed";
|
||||||
|
|
Loading…
Reference in New Issue