diff src/http/v3/ngx_http_v3_request.c @ 8460:72f9ff4e0a88 quic

HTTP/3: close QUIC connection with HTTP/QPACK errors when needed. Previously errors led only to closing streams. To simplify closing QUIC connection from a QUIC stream context, new macro ngx_http_v3_finalize_connection() is introduced. It calls ngx_quic_finalize_connection() for the parent connection.
author Roman Arutyunyan <arut@nginx.com>
date Thu, 02 Jul 2020 16:47:51 +0300
parents c9538aef3211
children 79125ef2e39f
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_request.c
+++ b/src/http/v3/ngx_http_v3_request.c
@@ -66,6 +66,12 @@ ngx_http_v3_parse_request(ngx_http_reque
     while (b->pos < b->last) {
         rc = ngx_http_v3_parse_headers(c, st, *b->pos);
 
+        if (rc > 0) {
+            ngx_http_v3_finalize_connection(c, rc,
+                                            "could not parse request headers");
+            goto failed;
+        }
+
         if (rc == NGX_ERROR) {
             goto failed;
         }
@@ -180,6 +186,12 @@ ngx_http_v3_parse_header(ngx_http_reques
     while (b->pos < b->last) {
         rc = ngx_http_v3_parse_headers(c, st, *b->pos++);
 
+        if (rc > 0) {
+            ngx_http_v3_finalize_connection(c, rc,
+                                            "could not parse request headers");
+            return NGX_HTTP_PARSE_INVALID_HEADER;
+        }
+
         if (rc == NGX_ERROR) {
             return NGX_HTTP_PARSE_INVALID_HEADER;
         }
@@ -359,6 +371,12 @@ ngx_http_v3_parse_request_body(ngx_http_
     while (b->pos < b->last) {
         rc = ngx_http_v3_parse_data(c, st, *b->pos++);
 
+        if (rc > 0) {
+            ngx_http_v3_finalize_connection(c, rc,
+                                            "could not parse request body");
+            goto failed;
+        }
+
         if (rc == NGX_ERROR) {
             goto failed;
         }