Commit e167e07a authored by Tatsuhiro Tsujikawa's avatar Tatsuhiro Tsujikawa

nghttpx: Check that HTTP response message finished safely

parent f3b9cd84
...@@ -1218,6 +1218,18 @@ int HttpDownstreamConnection::read_clear() { ...@@ -1218,6 +1218,18 @@ int HttpDownstreamConnection::read_clear() {
} }
if (nread < 0) { if (nread < 0) {
if (nread == SHRPX_ERR_EOF && !downstream_->get_upgraded()) {
auto htperr = llhttp_finish(&response_htp_);
if (htperr != HPE_OK) {
if (LOG_ENABLED(INFO)) {
DCLOG(INFO, this) << "HTTP response ended prematurely: "
<< llhttp_errno_name(htperr);
}
return -1;
}
}
return nread; return nread;
} }
...@@ -1337,6 +1349,18 @@ int HttpDownstreamConnection::read_tls() { ...@@ -1337,6 +1349,18 @@ int HttpDownstreamConnection::read_tls() {
} }
if (nread < 0) { if (nread < 0) {
if (nread == SHRPX_ERR_EOF && !downstream_->get_upgraded()) {
auto htperr = llhttp_finish(&response_htp_);
if (htperr != HPE_OK) {
if (LOG_ENABLED(INFO)) {
DCLOG(INFO, this) << "HTTP response ended prematurely: "
<< llhttp_errno_name(htperr);
}
return -1;
}
}
return nread; return nread;
} }
......
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