]> git.kaiwu.me - nginx.git/commitdiff
QUIC: fixed chain returned from ngx_quic_write_chain().
authorRoman Arutyunyan <arut@nginx.com>
Tue, 25 Jan 2022 06:45:50 +0000 (09:45 +0300)
committerRoman Arutyunyan <arut@nginx.com>
Tue, 25 Jan 2022 06:45:50 +0000 (09:45 +0300)
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.

src/event/quic/ngx_event_quic_frames.c

index 851af46438e259e8c1b13bd4d44b4c8fcf8154ae..951b6e8a22ff156529b3839224434eeaa1aab4d5 100644 (file)
@@ -536,14 +536,16 @@ ngx_quic_write_chain(ngx_connection_t *c, ngx_chain_t **chain, ngx_chain_t *in,
             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;
             }