nghttpx: Fix stream hang when http2 downstream CONNECT failed
This commit is contained in:
parent
005e60a5ed
commit
e55abcd634
|
@ -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
|
||||||
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) {
|
||||||
|
|
Loading…
Reference in New Issue