Commit 44ac5710 authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Add more handling situation where response ends before request

parent 5bff48a1
...@@ -420,6 +420,11 @@ int HttpsUpstream::on_write() ...@@ -420,6 +420,11 @@ int HttpsUpstream::on_write()
// Keep-alive // Keep-alive
downstream->detach_downstream_connection(); downstream->detach_downstream_connection();
} }
// We need this if response ends before request.
if(downstream->get_request_state() == Downstream::MSG_COMPLETE) {
delete_downstream();
return resume_read(SHRPX_MSG_BLOCK, nullptr, 0);
}
} }
rv = downstream->resume_read(SHRPX_NO_BUFFER, rv = downstream->resume_read(SHRPX_NO_BUFFER,
...@@ -568,6 +573,12 @@ void https_downstream_readcb(bufferevent *bev, void *ptr) ...@@ -568,6 +573,12 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
return; return;
} }
// Delete handler here if we have no pending write.
if(handler->get_should_close_after_write() &&
handler->get_outbuf_length() == 0) {
delete handler;
}
} }
} // namespace } // namespace
......
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