changeset 8705:ae2e68f206f9 quic

HTTP/3: removed http3_max_field_size. Instead, size of one large_client_header_buffers buffer is used.
author Roman Arutyunyan <arut@nginx.com>
date Tue, 16 Feb 2021 18:50:01 +0300
parents 13f7085b90d2
children 3057bae4dba7
files src/http/v3/ngx_http_v3.h src/http/v3/ngx_http_v3_module.c src/http/v3/ngx_http_v3_parse.c
diffstat 3 files changed, 5 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/src/http/v3/ngx_http_v3.h
+++ b/src/http/v3/ngx_http_v3.h
@@ -46,7 +46,6 @@
 #define NGX_HTTP_V3_STREAM_SERVER_DECODER          5
 #define NGX_HTTP_V3_MAX_KNOWN_STREAM               6
 
-#define NGX_HTTP_V3_DEFAULT_MAX_FIELD_SIZE         4096
 #define NGX_HTTP_V3_DEFAULT_MAX_TABLE_CAPACITY     16384
 #define NGX_HTTP_V3_DEFAULT_MAX_BLOCKED_STREAMS    16
 #define NGX_HTTP_V3_DEFAULT_MAX_CONCURRENT_PUSHES  10
@@ -86,7 +85,6 @@
 
 typedef struct {
     ngx_quic_tp_t                 quic;
-    size_t                        max_field_size;
     size_t                        max_table_capacity;
     ngx_uint_t                    max_blocked_streams;
     ngx_uint_t                    max_concurrent_pushes;
--- a/src/http/v3/ngx_http_v3_module.c
+++ b/src/http/v3/ngx_http_v3_module.c
@@ -24,13 +24,6 @@ static char *ngx_http_v3_push(ngx_conf_t
 
 static ngx_command_t  ngx_http_v3_commands[] = {
 
-    { ngx_string("http3_max_field_size"),
-      NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
-      ngx_conf_set_size_slot,
-      NGX_HTTP_SRV_CONF_OFFSET,
-      offsetof(ngx_http_v3_srv_conf_t, max_field_size),
-      NULL },
-
     { ngx_string("http3_max_table_capacity"),
       NGX_HTTP_MAIN_CONF|NGX_HTTP_SRV_CONF|NGX_CONF_TAKE1,
       ngx_conf_set_size_slot,
@@ -157,7 +150,6 @@ ngx_http_v3_create_srv_conf(ngx_conf_t *
         return NULL;
     }
 
-    h3scf->max_field_size = NGX_CONF_UNSET_SIZE;
     h3scf->max_table_capacity = NGX_CONF_UNSET_SIZE;
     h3scf->max_blocked_streams = NGX_CONF_UNSET_UINT;
     h3scf->max_concurrent_pushes = NGX_CONF_UNSET_UINT;
@@ -172,10 +164,6 @@ ngx_http_v3_merge_srv_conf(ngx_conf_t *c
     ngx_http_v3_srv_conf_t *prev = parent;
     ngx_http_v3_srv_conf_t *conf = child;
 
-    ngx_conf_merge_size_value(conf->max_field_size,
-                              prev->max_field_size,
-                              NGX_HTTP_V3_DEFAULT_MAX_FIELD_SIZE);
-
     ngx_conf_merge_size_value(conf->max_table_capacity,
                               prev->max_table_capacity,
                               NGX_HTTP_V3_DEFAULT_MAX_TABLE_CAPACITY);
--- a/src/http/v3/ngx_http_v3_parse.c
+++ b/src/http/v3/ngx_http_v3_parse.c
@@ -488,8 +488,8 @@ static 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_http_v3_srv_conf_t  *h3scf;
+    ngx_uint_t                 n;
+    ngx_http_core_srv_conf_t  *cscf;
     enum {
         sw_start = 0,
         sw_value
@@ -505,11 +505,11 @@ ngx_http_v3_parse_literal(ngx_connection
 
         n = st->length;
 
-        h3scf = ngx_http_v3_get_module_srv_conf(c, ngx_http_v3_module);
+        cscf = ngx_http_v3_get_module_srv_conf(c, ngx_http_core_module);
 
-        if (n > h3scf->max_field_size) {
+        if (n > cscf->large_client_header_buffers.size) {
             ngx_log_error(NGX_LOG_INFO, c->log, 0,
-                          "client exceeded http3_max_field_size limit");
+                          "client sent too large header field");
             return NGX_HTTP_V3_ERR_EXCESSIVE_LOAD;
         }