comparison src/http/v3/ngx_http_v3_parse.c @ 7949:032cb35ce758 quic

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.
author Roman Arutyunyan <arut@nginx.com>
date Mon, 29 Jun 2020 15:56:14 +0300
parents 5649079a41f4
children b0e81f49d7c0
comparison
equal deleted inserted replaced
7948:c8cabb5d45f5 7949:032cb35ce758
397 397
398 ngx_int_t 398 ngx_int_t
399 ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st, 399 ngx_http_v3_parse_literal(ngx_connection_t *c, ngx_http_v3_parse_literal_t *st,
400 u_char ch) 400 u_char ch)
401 { 401 {
402 ngx_uint_t n; 402 ngx_uint_t n;
403 ngx_http_v3_srv_conf_t *v3cf;
403 enum { 404 enum {
404 sw_start = 0, 405 sw_start = 0,
405 sw_value 406 sw_value
406 }; 407 };
407 408
412 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0, 413 ngx_log_debug2(NGX_LOG_DEBUG_HTTP, c->log, 0,
413 "http3 parse literal huff:%ui, len:%ui", 414 "http3 parse literal huff:%ui, len:%ui",
414 st->huffman, st->length); 415 st->huffman, st->length);
415 416
416 n = st->length; 417 n = st->length;
418
419 v3cf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
420
421 if (n > v3cf->max_field_size) {
422 ngx_log_error(NGX_LOG_ERR, c->log, 0,
423 "client exceeded http3_max_field_size limit");
424 return NGX_ERROR;
425 }
417 426
418 if (st->huffman) { 427 if (st->huffman) {
419 n = n * 8 / 5; 428 n = n * 8 / 5;
420 st->huffstate = 0; 429 st->huffstate = 0;
421 } 430 }