mirror of
https://github.com/nghttp2/nghttp2.git
synced 2025-12-08 02:58:53 +08:00
nghttpx: Fix stream hang when http2 downstream CONNECT failed
This commit is contained in:
@@ -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) {
|
||||||
|
|||||||
Reference in New Issue
Block a user