changeset 2:b049c3a0543e

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.
author Maxim Dounin <mdounin@mdounin.ru>
date Wed, 25 Aug 2021 19:36:57 +0300
parents 7c2d64d9c656
children 53cbdb610633
files ngx_http_delay_body_filter_module.c
diffstat 1 files changed, 0 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- 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 */) {