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.
This commit is contained in:
Roman Arutyunyan 2021-06-11 10:56:51 +03:00
parent bf7b32e1b6
commit 9cf6426f6a

View File

@ -1031,6 +1031,12 @@ ngx_http_v3_parse_control(ngx_connection_t *c, ngx_http_v3_parse_control_t *st,
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_t *c, ngx_http_v3_parse_control_t *st,
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;