diff --git a/src/shrpx_http_downstream_connection.cc b/src/shrpx_http_downstream_connection.cc index fc2f9d86..e1b90383 100644 --- a/src/shrpx_http_downstream_connection.cc +++ b/src/shrpx_http_downstream_connection.cc @@ -720,13 +720,6 @@ int HttpDownstreamConnection::on_read() { http_parser_execute(&response_htp_, &htp_hooks, reinterpret_cast(buf.data()), nread); - if (nproc != static_cast(nread)) { - if (LOG_ENABLED(INFO)) { - DCLOG(INFO, this) << "nproc != nread"; - } - return -1; - } - auto htperr = HTTP_PARSER_ERRNO(&response_htp_); if (htperr != HPE_OK) { @@ -739,6 +732,13 @@ int HttpDownstreamConnection::on_read() { return -1; } + if (nproc != static_cast(nread)) { + if (LOG_ENABLED(INFO)) { + DCLOG(INFO, this) << "nproc != nread"; + } + return -1; + } + if (downstream_->response_buf_full()) { downstream_->pause_read(SHRPX_NO_BUFFER); return 0;