Commit e55abcd6 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Fix stream hang when http2 downstream CONNECT failed

parent 005e60a5
...@@ -180,8 +180,12 @@ ssize_t spdy_data_read_callback(nghttp2_session *session, ...@@ -180,8 +180,12 @@ ssize_t spdy_data_read_callback(nghttp2_session *session,
nread = evbuffer_remove(body, buf, length); nread = evbuffer_remove(body, buf, length);
if(nread == 0) { if(nread == 0) {
if(downstream->get_request_state() == Downstream::MSG_COMPLETE) { if(downstream->get_request_state() == Downstream::MSG_COMPLETE) {
if(!downstream->get_upgrade_request()) { if(!downstream->get_upgrade_request() ||
(downstream->get_response_state() == Downstream::HEADER_COMPLETE &&
!downstream->get_upgraded())) {
*eof = 1; *eof = 1;
} else {
return NGHTTP2_ERR_DEFERRED;
} }
break; break;
} else { } else {
......
...@@ -828,6 +828,10 @@ void on_frame_recv_callback ...@@ -828,6 +828,10 @@ void on_frame_recv_callback
SSLOG(INFO, spdy) << "HTTP upgrade success. stream_id=" SSLOG(INFO, spdy) << "HTTP upgrade success. stream_id="
<< frame->hd.stream_id; << frame->hd.stream_id;
} }
} else if(downstream->get_request_method() == "CONNECT") {
// If request is CONNECT, terminate request body to avoid for
// stream to stall.
downstream->end_upload_data();
} }
rv = upstream->on_downstream_header_complete(downstream); rv = upstream->on_downstream_header_complete(downstream);
if(rv != 0) { if(rv != 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment