[nginx] Request body: simplified error handling in HTTP/2.

Maxim Dounin mdounin at mdounin.ru
Sat Apr 27 15:56:47 UTC 2024


details:   http://freenginx.org/hg/nginx/rev/c9550e77186c
branches:  
changeset: 9258:c9550e77186c
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Sat Apr 27 18:21:25 2024 +0300
description:
Request body: simplified error handling in HTTP/2.

No functional changes.

diffstat:

 src/http/v2/ngx_http_v2.c |  26 ++++++++++++++------------
 1 files changed, 14 insertions(+), 12 deletions(-)

diffs (48 lines):

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