comparison src/http/ngx_http_core_module.c @ 7563:a7e8f953408e

Fixed "return" with discarding invalid chunked body. When ngx_http_discard_request_body() call was added to ngx_http_send_response(), there were no return codes other than NGX_OK and NGX_HTTP_INTERNAL_SERVER_ERROR. Now it can also return NGX_HTTP_BAD_REQUEST, but ngx_http_send_response() still incorrectly transforms it to NGX_HTTP_INTERNAL_SERVER_ERROR. The fix is to propagate ngx_http_discard_request_body() errors.
author Sergey Kandaurov <pluknet@nginx.com>
date Wed, 04 Sep 2019 13:33:51 +0300
parents c19ca381b2e6
children 02a539522be4
comparison
equal deleted inserted replaced
7562:52b5ee64fe11 7563:a7e8f953408e
1658 ngx_int_t rc; 1658 ngx_int_t rc;
1659 ngx_str_t val; 1659 ngx_str_t val;
1660 ngx_buf_t *b; 1660 ngx_buf_t *b;
1661 ngx_chain_t out; 1661 ngx_chain_t out;
1662 1662
1663 if (ngx_http_discard_request_body(r) != NGX_OK) { 1663 rc = ngx_http_discard_request_body(r);
1664 return NGX_HTTP_INTERNAL_SERVER_ERROR; 1664
1665 if (rc != NGX_OK) {
1666 return rc;
1665 } 1667 }
1666 1668
1667 r->headers_out.status = status; 1669 r->headers_out.status = status;
1668 1670
1669 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) { 1671 if (ngx_http_complex_value(r, cv, &val) != NGX_OK) {