Welcome! Log In Create A New Profile

Advanced

[nginx] Request body: all read data are now sent to filters.

Maxim Dounin
August 05, 2020 11:44PM
details: https://hg.nginx.org/nginx/rev/08ff2e10ae92
branches:
changeset: 7691:08ff2e10ae92
user: Maxim Dounin <mdounin@mdounin.ru>
date: Thu Aug 06 05:02:44 2020 +0300
description:
Request body: all read data are now sent to filters.

This is a prerequisite for the next change to allow large reads
on chunk boundaries.

diffstat:

src/http/ngx_http_request_body.c | 53 +++++++--------------------------------
1 files changed, 10 insertions(+), 43 deletions(-)

diffs (82 lines):

diff -r 8253424d1aff -r 08ff2e10ae92 src/http/ngx_http_request_body.c
--- a/src/http/ngx_http_request_body.c Thu Aug 06 05:02:22 2020 +0300
+++ b/src/http/ngx_http_request_body.c Thu Aug 06 05:02:44 2020 +0300
@@ -282,28 +282,12 @@ ngx_http_do_read_client_request_body(ngx
for ( ;; ) {
if (rb->buf->last == rb->buf->end) {

- if (rb->buf->pos != rb->buf->last) {
-
- /* pass buffer to request body filter chain */
-
- out.buf = rb->buf;
- out.next = NULL;
-
- rc = ngx_http_request_body_filter(r, &out);
+ /* update chains */

- if (rc != NGX_OK) {
- return rc;
- }
-
- } else {
+ rc = ngx_http_request_body_filter(r, NULL);

- /* update chains */
-
- rc = ngx_http_request_body_filter(r, NULL);
-
- if (rc != NGX_OK) {
- return rc;
- }
+ if (rc != NGX_OK) {
+ return rc;
}

if (rb->busy != NULL) {
@@ -355,17 +339,15 @@ ngx_http_do_read_client_request_body(ngx
rb->buf->last += n;
r->request_length += n;

- if (n == rest) {
- /* pass buffer to request body filter chain */
+ /* pass buffer to request body filter chain */

- out.buf = rb->buf;
- out.next = NULL;
+ out.buf = rb->buf;
+ out.next = NULL;

- rc = ngx_http_request_body_filter(r, &out);
+ rc = ngx_http_request_body_filter(r, &out);

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

if (rb->rest == 0) {
@@ -386,21 +368,6 @@ ngx_http_do_read_client_request_body(ngx

if (!c->read->ready) {

- if (r->request_body_no_buffering
- && rb->buf->pos != rb->buf->last)
- {
- /* pass buffer to request body filter chain */
-
- out.buf = rb->buf;
- out.next = NULL;
-
- rc = ngx_http_request_body_filter(r, &out);
-
- if (rc != NGX_OK) {
- return rc;
- }
- }
-
clcf = ngx_http_get_module_loc_conf(r, ngx_http_core_module);
ngx_add_timer(c->read, clcf->client_body_timeout);

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://mailman.nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

[nginx] Request body: all read data are now sent to filters.

Maxim Dounin 271 August 05, 2020 11:44PM



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

Online Users

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