diff options
| author | Roman Arutyunyan <arut@nginx.com> | 2021-09-30 17:14:42 +0300 |
|---|---|---|
| committer | Roman Arutyunyan <arut@nginx.com> | 2021-09-30 17:14:42 +0300 |
| commit | b6b2a45fb6824185889373cc0af070c4a90c1b4a (patch) | |
| tree | bc64d7704e0d1ed8758f475b76639e2b878c7f97 /src | |
| parent | 3c31d3f42129689c5d8837d94fad0e44db9129a8 (diff) | |
| download | nginx-b6b2a45fb6824185889373cc0af070c4a90c1b4a.tar.gz nginx-b6b2a45fb6824185889373cc0af070c4a90c1b4a.tar.bz2 | |
Added r->response_sent flag.
The flag indicates that the entire response was sent to the socket up to the
last_buf flag. The flag is only usable for protocol implementations that call
ngx_http_write_filter() from header filter, such as HTTP/1.x and HTTP/3.
Diffstat (limited to '')
| -rw-r--r-- | src/http/ngx_http_request.h | 1 | ||||
| -rw-r--r-- | src/http/ngx_http_write_filter_module.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/src/http/ngx_http_request.h b/src/http/ngx_http_request.h index aee9109c3..a19e975b2 100644 --- a/src/http/ngx_http_request.h +++ b/src/http/ngx_http_request.h @@ -547,6 +547,7 @@ struct ngx_http_request_s { unsigned request_complete:1; unsigned request_output:1; unsigned header_sent:1; + unsigned response_sent:1; unsigned expect_tested:1; unsigned root_tested:1; unsigned done:1; diff --git a/src/http/ngx_http_write_filter_module.c b/src/http/ngx_http_write_filter_module.c index 6a5d957b1..2a4996251 100644 --- a/src/http/ngx_http_write_filter_module.c +++ b/src/http/ngx_http_write_filter_module.c @@ -239,6 +239,10 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) r->out = NULL; c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; + if (last) { + r->response_sent = 1; + } + return NGX_OK; } @@ -350,6 +354,10 @@ ngx_http_write_filter(ngx_http_request_t *r, ngx_chain_t *in) c->buffered &= ~NGX_HTTP_WRITE_BUFFERED; + if (last) { + r->response_sent = 1; + } + if ((c->buffered & NGX_LOWLEVEL_BUFFERED) && r->postponed == NULL) { return NGX_AGAIN; } |
