]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: do not block the output queue on trailers
authorSergey Kandaurov <pluknet@nginx.com>
Fri, 25 Sep 2026 15:34:44 +0000 (15:34 +0000)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 4 Nov 2026 18:09:10 +0000 (22:09 +0400)
Unlike response headers, trailers are queued along with the stream data.
Blocking the queue on them would hold back every frame queued later,
including higher priority streams.

Also, this way unsent trailers are discarded along with the stream data
when the stream is reset.

src/http/v2/ngx_http_v2_filter_module.c

index c82cbbddf9864ae004cf29cf4ea46745cf889b47..61e637137451c3572352edf55077bdb60c613220 100644 (file)
@@ -1227,6 +1227,7 @@ ngx_http_v2_send_chain(ngx_connection_t *fc, ngx_chain_t *in, off_t limit)
             }
 
             if (trailers != NGX_HTTP_V2_NO_TRAILERS) {
+                trailers->blocked = 0;
                 cl->buf->last_buf = 0;
             }
         }
@@ -1732,7 +1733,9 @@ ngx_http_v2_filter_cleanup(void *data)
         if (frame->stream == stream && !frame->blocked) {
             *fn = frame->next;
 
-            window += frame->length;
+            if (frame->handler == ngx_http_v2_data_frame_handler) {
+                window += frame->length;
+            }
 
             if (--stream->queued == 0) {
                 break;