nghttpx: Fix bug that chunked request stalls

This commit is contained in:
Tatsuhiro Tsujikawa 2019-04-15 23:43:03 +09:00
parent ce962c3fdf
commit 2cff8b43cf
2 changed files with 10 additions and 4 deletions

View File

@ -696,8 +696,9 @@ int HttpDownstreamConnection::process_blocked_request_buf() {
}
}
if (downstream_->get_blocked_request_data_eof()) {
return end_upload_data();
if (downstream_->get_blocked_request_data_eof() &&
downstream_->get_chunked_request()) {
end_upload_data_chunk();
}
return 0;
@ -751,6 +752,12 @@ int HttpDownstreamConnection::end_upload_data() {
return 0;
}
end_upload_data_chunk();
return 0;
}
void HttpDownstreamConnection::end_upload_data_chunk() {
const auto &req = downstream_->request();
auto output = downstream_->get_request_buf();
@ -763,8 +770,6 @@ int HttpDownstreamConnection::end_upload_data() {
http2::HDOP_STRIP_ALL);
output->append("\r\n");
}
return 0;
}
namespace {

View File

@ -53,6 +53,7 @@ public:
virtual int push_request_headers();
virtual int push_upload_data_chunk(const uint8_t *data, size_t datalen);
virtual int end_upload_data();
void end_upload_data_chunk();
virtual void pause_read(IOCtrlReason reason);
virtual int resume_read(IOCtrlReason reason, size_t consumed);