Sergey Kandaurov
September 04, 2019 08:02AM
details: https://hg.nginx.org/nginx/rev/a7e8f953408e
branches:
changeset: 7563:a7e8f953408e
user: Sergey Kandaurov <pluknet@nginx.com>
date: Wed Sep 04 13:33:51 2019 +0300
description:
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.

diffstat:

src/http/ngx_http_core_module.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diffs (16 lines):

diff -r 52b5ee64fe11 -r a7e8f953408e src/http/ngx_http_core_module.c
--- a/src/http/ngx_http_core_module.c Tue Sep 03 17:26:56 2019 +0300
+++ b/src/http/ngx_http_core_module.c Wed Sep 04 13:33:51 2019 +0300
@@ -1660,8 +1660,10 @@ ngx_http_send_response(ngx_http_request_
ngx_buf_t *b;
ngx_chain_t out;

- if (ngx_http_discard_request_body(r) != NGX_OK) {
- return NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = ngx_http_discard_request_body(r);
+
+ if (rc != NGX_OK) {
+ return rc;
}

r->headers_out.status = status;
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Fixed "return" with discarding invalid chunked body.

Sergey Kandaurov 301 September 04, 2019 08:02AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 304
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready