Maxim Dounin
November 09, 2020 04:22PM
details: https://hg.nginx.org/nginx/rev/967cfa6e2ff8
branches:
changeset: 7740:967cfa6e2ff8
user: Maxim Dounin <mdounin@mdounin.ru>
date: Mon Nov 09 22:41:54 2020 +0300
description:
Request body: removed error assumption (ticket #2058).

Before introduction of request body filter in 42d9beeb22db, the only
possible return code from the ngx_http_request_body_filter() call
without actual buffers was NGX_HTTP_INTERNAL_SERVER_ERROR, and
the code in ngx_http_read_client_request_body() hardcoded the only
possible error to simplify the code of initial call to set rb->rest.

This is no longer true after introduction of request body filters though,
as a request body filter might need to return other errors, such as 403.
Fix is to preserve the error code actually returned by the call
instead of assuming 500.

diffstat:

src/http/ngx_http_request_body.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)

diffs (15 lines):

diff -r 4d5b04daeaff -r 967cfa6e2ff8 src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c Mon Nov 09 22:40:53 2020 +0300
+++ b/src/http/ngx_http_request_body.c Mon Nov 09 22:41:54 2020 +0300
@@ -137,8 +137,9 @@ ngx_http_read_client_request_body(ngx_ht
} else {
/* set rb->rest */

- if (ngx_http_request_body_filter(r, NULL) != NGX_OK) {
- rc = NGX_HTTP_INTERNAL_SERVER_ERROR;
+ rc = ngx_http_request_body_filter(r, NULL);
+
+ if (rc != NGX_OK) {
goto done;
}
}
_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Request body: removed error assumption (ticket #2058).

Maxim Dounin 441 November 09, 2020 04:22PM



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

Online Users

Guests: 243
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