changeset 8873:94daa42ff5ce quic

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.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 30 Sep 2021 17:14:42 +0300
parents 2706d27d2c76
children 7f4b2687ac80
files src/http/ngx_http_request.h src/http/ngx_http_write_filter_module.c
diffstat 2 files changed, 9 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/ngx_http_request.h	Wed Sep 29 15:06:28 2021 +0300
+++ b/src/http/ngx_http_request.h	Thu Sep 30 17:14:42 2021 +0300
@@ -547,6 +547,7 @@
     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;
--- a/src/http/ngx_http_write_filter_module.c	Wed Sep 29 15:06:28 2021 +0300
+++ b/src/http/ngx_http_write_filter_module.c	Thu Sep 30 17:14:42 2021 +0300
@@ -239,6 +239,10 @@
             r->out = NULL;
             c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
 
+            if (last) {
+                r->response_sent = 1;
+            }
+
             return NGX_OK;
         }
 
@@ -350,6 +354,10 @@
 
     c->buffered &= ~NGX_HTTP_WRITE_BUFFERED;
 
+    if (last) {
+        r->response_sent = 1;
+    }
+
     if ((c->buffered & NGX_LOWLEVEL_BUFFERED) && r->postponed == NULL) {
         return NGX_AGAIN;
     }