# HG changeset patch # User Maxim Dounin # Date 1629909417 -10800 # Node ID b049c3a0543e3b56bd3379ecdf552e30ca8568b4 # Parent 7c2d64d9c6564c7d07316ab85b98f06af8df4184 Simplified for the code without buffered counter. The only new flag which needs to be set is rb->filter_need_buffering, which is mostly needed for HTTP/2, where it is not possible to delay request body processing when flow control is not used. diff --git a/ngx_http_delay_body_filter_module.c b/ngx_http_delay_body_filter_module.c --- a/ngx_http_delay_body_filter_module.c +++ b/ngx_http_delay_body_filter_module.c @@ -16,7 +16,6 @@ typedef struct { typedef struct { ngx_event_t event; ngx_chain_t *out; - ngx_uint_t buffered; } ngx_http_delay_body_ctx_t; @@ -105,9 +104,7 @@ ngx_http_delay_body_filter(ngx_http_requ ngx_http_set_ctx(r, ctx, ngx_http_delay_body_filter_module); -#if 1 /* XXX */ r->request_body->filter_need_buffering = 1; -#endif } if (ngx_chain_add_copy(r->pool, &ctx->out, in) != NGX_OK) { @@ -134,23 +131,11 @@ ngx_http_delay_body_filter(ngx_http_requ ctx->event.log = r->connection->log; ngx_add_timer(&ctx->event, conf->delay); - - ctx->buffered = 1; -#if 1 /* XXX */ - r->request_body->buffered++; -#endif } return ngx_http_next_request_body_filter(r, NULL); } - if (ctx->buffered) { - ctx->buffered = 0; -#if 1 /* XXX */ - r->request_body->buffered--; -#endif - } - rc = ngx_http_next_request_body_filter(r, ctx->out); for (cl = ctx->out; cl; /* void */) {