[PATCH] HTTP/2: emit PROTOCOL_ERROR on invalid ENABLE_PUSH setting value
Valentin V. Bartenev
vbart at nginx.com
Mon Mar 27 19:40:57 UTC 2017
On Sunday 26 March 2017 01:41:16 Piotr Sikora via nginx-devel wrote:
> # HG changeset patch
> # User Piotr Sikora <piotrsikora at google.com>
> # Date 1490516707 25200
> # Sun Mar 26 01:25:07 2017 -0700
> # Node ID 705897a463205ba00dce296ff49866c6b78fc6ee
> # Parent 22be63bf21edaa1b8ea916c7d8cd4e5fe4892061
> HTTP/2: emit PROTOCOL_ERROR on invalid ENABLE_PUSH setting value.
>
> Signed-off-by: Piotr Sikora <piotrsikora at google.com>
>
> diff -r 22be63bf21ed -r 705897a46320 src/http/v2/ngx_http_v2.c
> --- a/src/http/v2/ngx_http_v2.c
> +++ b/src/http/v2/ngx_http_v2.c
> @@ -40,6 +40,7 @@
>
> /* settings fields */
> #define NGX_HTTP_V2_HEADER_TABLE_SIZE_SETTING 0x1
> +#define NGX_HTTP_V2_ENABLE_PUSH_SETTING 0x2
> #define NGX_HTTP_V2_MAX_STREAMS_SETTING 0x3
> #define NGX_HTTP_V2_INIT_WINDOW_SIZE_SETTING 0x4
> #define NGX_HTTP_V2_MAX_FRAME_SIZE_SETTING 0x5
> @@ -1993,6 +1994,19 @@ ngx_http_v2_state_settings_params(ngx_ht
>
> switch (id) {
>
> + case NGX_HTTP_V2_ENABLE_PUSH_SETTING:
> +
> + if (value != 0 && value != 1) {
> + ngx_log_error(NGX_LOG_INFO, h2c->connection->log, 0,
> + "client sent SETTINGS frame with incorrect "
> + "ENABLE_PUSH value %ui", value);
> +
> + return ngx_http_v2_connection_error(h2c,
> + NGX_HTTP_V2_PROTOCOL_ERROR);
> + }
> +
> + break;
> +
> case NGX_HTTP_V2_INIT_WINDOW_SIZE_SETTING:
>
> if (value > NGX_HTTP_V2_MAX_WINDOW) {
Is there any practical reason for the check considering that
the value is ignored anyway?
wbr, Valentin V. Bartenev
More information about the nginx-devel
mailing list