nghttpx: Handle error from Upstream::resume_read in upgrade code
This commit is contained in:
parent
924b1bd61a
commit
8cb92fc277
|
@ -367,7 +367,10 @@ int htp_hdrs_completecb(http_parser *htp)
|
||||||
|
|
||||||
if(downstream->get_upgraded()) {
|
if(downstream->get_upgraded()) {
|
||||||
// Upgrade complete, read until EOF in both ends
|
// Upgrade complete, read until EOF in both ends
|
||||||
downstream->get_upstream()->resume_read(SHRPX_MSG_BLOCK, downstream);
|
if(downstream->get_upstream()->resume_read(SHRPX_MSG_BLOCK,
|
||||||
|
downstream) != 0) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
downstream->set_request_state(Downstream::HEADER_COMPLETE);
|
downstream->set_request_state(Downstream::HEADER_COMPLETE);
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
LOG(INFO) << "HTTP upgrade success. stream_id="
|
LOG(INFO) << "HTTP upgrade success. stream_id="
|
||||||
|
|
|
@ -818,7 +818,11 @@ void on_frame_recv_callback
|
||||||
if(downstream->get_upgraded()) {
|
if(downstream->get_upgraded()) {
|
||||||
downstream->set_response_connection_close(true);
|
downstream->set_response_connection_close(true);
|
||||||
// On upgrade sucess, both ends can send data
|
// On upgrade sucess, both ends can send data
|
||||||
upstream->resume_read(SHRPX_MSG_BLOCK, downstream);
|
if(upstream->resume_read(SHRPX_MSG_BLOCK, downstream) != 0) {
|
||||||
|
// If resume_read fails, just drop connection. Not ideal.
|
||||||
|
delete upstream->get_client_handler();
|
||||||
|
return;
|
||||||
|
}
|
||||||
downstream->set_request_state(Downstream::HEADER_COMPLETE);
|
downstream->set_request_state(Downstream::HEADER_COMPLETE);
|
||||||
if(LOG_ENABLED(INFO)) {
|
if(LOG_ENABLED(INFO)) {
|
||||||
SSLOG(INFO, spdy) << "HTTP upgrade success. stream_id="
|
SSLOG(INFO, spdy) << "HTTP upgrade success. stream_id="
|
||||||
|
|
Loading…
Reference in New Issue