]> git.kaiwu.me - nginx.git/commitdiff
HTTP/2: fixed handling of INITIAL_WINDOW_SIZE with exceeding delta
authorSergey Kandaurov <pluknet@nginx.com>
Thu, 12 Nov 2026 19:30:20 +0000 (23:30 +0400)
committerSergey Kandaurov <pluknet@nginx.com>
Wed, 25 Nov 2026 17:36:52 +0000 (21:36 +0400)
Per RFC 9113, Section 6.9.2, it is a connection error.

src/http/v2/ngx_http_v2.c

index 807dd59c10f33a43323be793e95e6a97bc975180..23b72f2ddb9856320041d219655b1b812c42a1f4 100644 (file)
@@ -2358,7 +2358,7 @@ ngx_http_v2_state_settings_params(ngx_http_v2_connection_t *h2c, u_char *pos,
         if (ngx_http_v2_adjust_windows(h2c, h2c->state.window_delta) != NGX_OK)
         {
             return ngx_http_v2_connection_error(h2c,
-                                                NGX_HTTP_V2_INTERNAL_ERROR);
+                                                NGX_HTTP_V2_FLOW_CTRL_ERROR);
         }
 
         h2c->state.window_delta = 0;
@@ -5069,14 +5069,13 @@ ngx_http_v2_adjust_windows(ngx_http_v2_connection_t *h2c, ssize_t delta)
                 && stream->send_window
                       > (ssize_t) (NGX_HTTP_V2_MAX_WINDOW - delta))
             {
-                if (ngx_http_v2_terminate_stream(h2c, stream,
-                                                 NGX_HTTP_V2_FLOW_CTRL_ERROR)
-                    == NGX_ERROR)
-                {
-                    return NGX_ERROR;
-                }
-
-                continue;
+                ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
+                              "client violated flow control for stream %ui: "
+                              "received INITIAL_WINDOW_SIZE "
+                              "with window increment %uz "
+                              "not allowed for window %z",
+                              node->id, delta, stream->send_window);
+                return NGX_ERROR;
             }
 
             stream->send_window += delta;