changeset 9258:c9550e77186c

Request body: simplified error handling in HTTP/2. No functional changes.
author Maxim Dounin <mdounin@mdounin.ru>
date Sat, 27 Apr 2024 18:21:25 +0300
parents 0748264a1278
children 81082b5521dd
files src/http/v2/ngx_http_v2.c
diffstat 1 files changed, 14 insertions(+), 12 deletions(-) [+]
line wrap: on
line diff
--- 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;
+
 }