changeset 8975:000b9b048e0c quic

QUIC: fixed chain returned from ngx_quic_write_chain(). Previously, when input ended on a QUIC buffer boundary, input chain was not advanced to the next buffer. As a result, ngx_quic_write_chain() returned a chain with an empty buffer instead of NULL. This broke HTTP write filter, preventing it from closing the HTTP request and eventually timing out. Now input chain is always advanced to a buffer that has data, before checking QUIC buffer boundary condition.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 25 Jan 2022 09:45:50 +0300
parents c389200e10a2
children 4646a981111f
files src/event/quic/ngx_event_quic_frames.c
diffstat 1 files changed, 4 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/event/quic/ngx_event_quic_frames.c
+++ b/src/event/quic/ngx_event_quic_frames.c
@@ -536,14 +536,16 @@ ngx_quic_write_chain(ngx_connection_t *c
             continue;
         }
 
-        for (p = b->pos + offset; p != b->last && in; /* void */ ) {
+        p = b->pos + offset;
+
+        while (in) {
 
             if (!ngx_buf_in_memory(in->buf) || in->buf->pos == in->buf->last) {
                 in = in->next;
                 continue;
             }
 
-            if (limit == 0) {
+            if (p == b->last || limit == 0) {
                 break;
             }