diff options
author | Roman Arutyunyan <arut@nginx.com> | 2020-06-29 15:56:14 +0300 |
---|---|---|
committer | Roman Arutyunyan <arut@nginx.com> | 2020-06-29 15:56:14 +0300 |
commit | 8d41d17a12509d6f80f51a27046b7a10882892ef (patch) | |
tree | 2d770af188c8fadec87f347cc88a19349c413b4a /src/http/v3/ngx_http_v3_parse.c | |
parent | b7662c0e80003a676375be7d46071231321260e6 (diff) | |
download | nginx-8d41d17a12509d6f80f51a27046b7a10882892ef.tar.gz nginx-8d41d17a12509d6f80f51a27046b7a10882892ef.zip |
HTTP/3: http3_max_field_size directive to limit string size.
Client streams may send literal strings which are now limited in size by the
new directive. The default value is 4096.
The directive is similar to HTTP/2 directive http2_max_field_size.
Diffstat (limited to 'src/http/v3/ngx_http_v3_parse.c')
-rw-r--r-- | src/http/v3/ngx_http_v3_parse.c | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/http/v3/ngx_http_v3_parse.c b/src/http/v3/ngx_http_v3_parse.c index 3be3802ed..71a643d70 100644 --- a/src/http/v3/ngx_http_v3_parse.c +++ b/src/http/v3/ngx_http_v3_parse.c @@ -399,7 +399,8 @@ ngx_int_t ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, u_char ch) { - ngx_uint_t n; + ngx_uint_t n; + ngx_http_v3_srv_conf_t *v3cf; enum { sw_start = 0, sw_value @@ -415,6 +416,14 @@ ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, n = st->length; + v3cf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module); + + if (n > v3cf->max_field_size) { + ngx_log_error(NGX_LOG_ERR, c->log, 0, + "client exceeded http3_max_field_size limit"); + return NGX_ERROR; + } + if (st->huffman) { n = n * 8 / 5; st->huffstate = 0; |