From 1d7601edfb41f04f211399d510497435362de860 Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Tue, 18 Nov 2014 00:03:52 +0900 Subject: [PATCH] nghttpx: Better handling EOF from downstream connection to tunnel stream --- src/shrpx_http2_upstream.cc | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/shrpx_http2_upstream.cc b/src/shrpx_http2_upstream.cc index bb159717..bbbbd64a 100644 --- a/src/shrpx_http2_upstream.cc +++ b/src/shrpx_http2_upstream.cc @@ -1015,7 +1015,11 @@ void downstream_eventcb(bufferevent *bev, short events, void *ptr) } } else { if(downstream->get_response_state() == Downstream::HEADER_COMPLETE) { - upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR); + if(downstream->get_upgraded()) { + upstream->on_downstream_body_complete(downstream); + } else { + upstream->rst_stream(downstream, NGHTTP2_INTERNAL_ERROR); + } } else { unsigned int status; if(events & BEV_EVENT_TIMEOUT) { @@ -1102,8 +1106,9 @@ ssize_t downstream_data_read_callback(nghttp2_session *session, if(nread == 0 && downstream->get_response_state() == Downstream::MSG_COMPLETE) { + *data_flags |= NGHTTP2_DATA_FLAG_EOF; + if(!downstream->get_upgraded()) { - *data_flags |= NGHTTP2_DATA_FLAG_EOF; upstream_accesslog(upstream->get_client_handler()->get_ipaddr(), downstream->get_response_http_status(),