HTTP/3: close stream with H3_MESSAGE_ERROR on malformed pseudo-headers

RFC 9114, Section 4.1.2. specifies

  Malformed requests or responses that are detected MUST be treated as
  a stream error of type H3_MESSAGE_ERROR.
This commit is contained in:
Jan Svojanovsky 2025-12-17 16:31:13 +01:00
parent 0609736a92
commit 53efe519de
No known key found for this signature in database
2 changed files with 3 additions and 0 deletions

View file

@ -69,6 +69,7 @@
#define NGX_HTTP_V3_ERR_REQUEST_REJECTED 0x10b
#define NGX_HTTP_V3_ERR_REQUEST_CANCELLED 0x10c
#define NGX_HTTP_V3_ERR_REQUEST_INCOMPLETE 0x10d
#define NGX_HTTP_V3_ERR_MESSAGE_ERROR 0x10e
#define NGX_HTTP_V3_ERR_CONNECT_ERROR 0x10f
#define NGX_HTTP_V3_ERR_VERSION_FALLBACK 0x110

View file

@ -995,6 +995,7 @@ ngx_http_v3_init_pseudo_headers(ngx_http_request_t *r)
failed:
ngx_quic_reset_stream(r->connection, NGX_HTTP_V3_ERR_MESSAGE_ERROR);
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
return NGX_ERROR;
}
@ -1103,6 +1104,7 @@ ngx_http_v3_process_request_header(ngx_http_request_t *r)
failed:
ngx_quic_reset_stream(r->connection, NGX_HTTP_V3_ERR_MESSAGE_ERROR);
ngx_http_finalize_request(r, NGX_HTTP_BAD_REQUEST);
return NGX_ERROR;
}