nghttpx: Fix crash in http/1 backend when backend returns more bytes than CL

This is typically programming mistake that we did not check return
value before doing another.
This commit is contained in:
Tatsuhiro Tsujikawa 2015-02-21 21:17:52 +09:00
parent c506386997
commit 7f9de007d0
1 changed files with 8 additions and 8 deletions

View File

@ -455,6 +455,14 @@ int HttpsUpstream::downstream_read(DownstreamConnection *dconn) {
rv = downstream->on_read();
if (rv == SHRPX_ERR_EOF) {
return downstream_eof(dconn);
}
if (rv < 0) {
return downstream_error(dconn, Downstream::EVENT_ERROR);
}
if (downstream->get_response_state() == Downstream::MSG_RESET) {
return -1;
}
@ -473,14 +481,6 @@ int HttpsUpstream::downstream_read(DownstreamConnection *dconn) {
downstream->detach_downstream_connection();
}
if (rv == SHRPX_ERR_EOF) {
return downstream_eof(dconn);
}
if (rv < 0) {
return downstream_error(dconn, Downstream::EVENT_ERROR);
}
end:
handler_->signal_write();