nghttpx: Add more handling situation where response ends before request

This commit is contained in:
Tatsuhiro Tsujikawa 2014-09-17 22:53:29 +09:00
parent 5bff48a15a
commit 44ac571037
1 changed files with 11 additions and 0 deletions

View File

@ -420,6 +420,11 @@ int HttpsUpstream::on_write()
// Keep-alive
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,
@ -568,6 +573,12 @@ void https_downstream_readcb(bufferevent *bev, void *ptr)
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