changeset 8794:ba5977b38b2e quic

HTTP/3: reordered H3_MISSING_SETTINGS and H3_FRAME_UNEXPECTED. The quic-http-34 is ambiguous as to what error should be generated for the first frame in control stream: Each side MUST initiate a single control stream at the beginning of the connection and send its SETTINGS frame as the first frame on this stream. If the first frame of the control stream is any other frame type, this MUST be treated as a connection error of type H3_MISSING_SETTINGS. If a DATA frame is received on a control stream, the recipient MUST respond with a connection error of type H3_FRAME_UNEXPECTED. If a HEADERS frame is received on a control stream, the recipient MUST respond with a connection error of type H3_FRAME_UNEXPECTED. Previously, H3_FRAME_UNEXPECTED had priority, but now H3_MISSING_SETTINGS has. The arguments in the spec sound more compelling for H3_MISSING_SETTINGS.
author Roman Arutyunyan <arut@nginx.com>
date Fri, 11 Jun 2021 10:56:51 +0300
parents 80d396fd8ee8
children 278ab0ed24f2
files src/http/v3/ngx_http_v3_parse.c
diffstat 1 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3_parse.c
+++ b/src/http/v3/ngx_http_v3_parse.c
@@ -1031,6 +1031,12 @@ ngx_http_v3_parse_control(ngx_connection
         ngx_log_debug1(NGX_LOG_DEBUG_HTTP, c->log, 0,
                        "http3 parse frame type:%ui", st->type);
 
+        if (st->state == sw_first_type
+            && st->type != NGX_HTTP_V3_FRAME_SETTINGS)
+        {
+            return NGX_HTTP_V3_ERR_MISSING_SETTINGS;
+        }
+
         if (ngx_http_v3_is_v2_frame(st->type)
             || st->type == NGX_HTTP_V3_FRAME_DATA
             || st->type == NGX_HTTP_V3_FRAME_HEADERS)
@@ -1038,12 +1044,6 @@ ngx_http_v3_parse_control(ngx_connection
             return NGX_HTTP_V3_ERR_FRAME_UNEXPECTED;
         }
 
-        if (st->state == sw_first_type
-            && st->type != NGX_HTTP_V3_FRAME_SETTINGS)
-        {
-            return NGX_HTTP_V3_ERR_MISSING_SETTINGS;
-        }
-
         st->state = sw_length;
         break;