[PATCH 09 of 14] Request body: simplified error handling in HTTP/2

Maxim Dounin mdounin at mdounin.ru
Sat Apr 20 00:59:57 UTC 2024


# HG changeset patch
# User Maxim Dounin <mdounin at mdounin.ru>
# Date 1713574640 -10800
#      Sat Apr 20 03:57:20 2024 +0300
# Node ID 20eed25e08bb2b46bd5deddba63f5b4d4779e4a4
# Parent  976af6df50499768d08b176e9ae0ec0e1096ae88
Request body: simplified error handling in HTTP/2.

No functional changes.

diff --git a/src/http/v2/ngx_http_v2.c b/src/http/v2/ngx_http_v2.c
--- a/src/http/v2/ngx_http_v2.c
+++ b/src/http/v2/ngx_http_v2.c
@@ -4238,11 +4238,7 @@ ngx_http_v2_read_client_request_body_han
         if (window < stream->recv_window) {
             ngx_log_error(NGX_LOG_ALERT, r->connection->log, 0,
                           "http2 negative window update");
-
-            stream->skip_data = 1;
-
-            ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
-            return;
+            goto error;
         }
 
         return;
@@ -4252,18 +4248,24 @@ ngx_http_v2_read_client_request_body_han
                                        window - stream->recv_window)
         == NGX_ERROR)
     {
-        stream->skip_data = 1;
-        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
-        return;
+        goto error;
     }
 
     stream->recv_window = window;
 
     if (ngx_http_v2_send_output_queue(h2c) == NGX_ERROR) {
-        stream->skip_data = 1;
-        ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
-        return;
-    }
+        goto error;
+    }
+
+    return;
+
+error:
+
+    stream->skip_data = 1;
+
+    ngx_http_finalize_request(r, NGX_HTTP_INTERNAL_SERVER_ERROR);
+    return;
+
 }
 
 




More information about the nginx-devel mailing list