nghttpx: Don't upgrade to HTTP/2 if we have non-final HTTP/1 response pending

This commit is contained in:
Tatsuhiro Tsujikawa 2015-05-25 23:59:44 +09:00
parent 5fdb36239a
commit 7e51a87111
1 changed files with 5 additions and 0 deletions

View File

@ -348,6 +348,11 @@ int htp_msg_completecb(http_parser *htp) {
if (handler->get_http2_upgrade_allowed() &&
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) {
if (LOG_ENABLED(INFO)) {
ULOG(INFO, upstream) << "HTTP Upgrade to HTTP/2 failed";