]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: h2: expose tune.h2.header-table-size to configure the table size
authorWilly Tarreau <w@1wt.eu>
Thu, 27 Jul 2017 09:42:14 +0000 (11:42 +0200)
committerWilly Tarreau <w@1wt.eu>
Tue, 31 Oct 2017 17:03:24 +0000 (18:03 +0100)
It's the HPACK header table size which is to be advertised in the settings
frames. It defaults to 4096.

doc/configuration.txt
src/mux_h2.c

index 0ef8103a63aff97545a59d9825330eee9bf1a8ba..5543f4c8d4708a429b63c2f15af85a09932b76eb 100644 (file)
@@ -599,6 +599,7 @@ The following keywords are supported in the "global" section :
    - tune.bufsize
    - tune.chksize
    - tune.comp.maxlevel
+   - tune.h2.header-table-size
    - tune.http.cookielen
    - tune.http.logurilen
    - tune.http.maxhdr
@@ -1367,6 +1368,13 @@ tune.comp.maxlevel <number>
   Each session using compression initializes the compression algorithm with
   this value. The default value is 1.
 
+tune.h2.header-table-size <number>
+  Sets the HTTP/2 dynamic header table size. It defaults to 4096 bytes and
+  cannot be larger than 65536 bytes. A larger value may help certain clients
+  send more compact requests, depending on their capabilities. This amount of
+  memory is consumed for each HTTP/2 connection. It is recommended not to
+  change it.
+
 tune.http.cookielen <number>
   Sets the maximum length of captured cookies. This is the maximum value that
   the "capture cookie xxx len yyy" will be allowed to take, and any upper value
index a15e4c723672c60887785061394d11bf9cdc89a3..3fbac8c0035e47fd2597bdd73bbb08f7bd040377 100644 (file)
 #include <proto/stream.h>
 
 
+/* a few settings from the global section */
+static int h2_settings_header_table_size      =  4096; /* initial value */
+
+
 /*****************************************************************/
 /* functions below are dedicated to the mux setup and management */
 /*****************************************************************/
@@ -126,6 +130,21 @@ static int h2_snd_buf(struct conn_stream *cs, struct buffer *buf, int flags)
 /* functions below are dedicated to the config parsers */
 /*******************************************************/
 
+/* config parser for global "tune.h2.header-table-size" */
+static int h2_parse_header_table_size(char **args, int section_type, struct proxy *curpx,
+                                      struct proxy *defpx, const char *file, int line,
+                                      char **err)
+{
+       if (too_many_args(1, args, err, NULL))
+               return -1;
+
+       h2_settings_header_table_size = atoi(args[1]);
+       if (h2_settings_header_table_size < 4096 || h2_settings_header_table_size > 65536) {
+               memprintf(err, "'%s' expects a numeric value between 4096 and 65536.", args[0]);
+               return -1;
+       }
+       return 0;
+}
 
 
 /****************************************/
@@ -155,6 +174,7 @@ static struct alpn_mux_list alpn_mux_h2 =
 
 /* config keyword parsers */
 static struct cfg_kw_list cfg_kws = {ILH, {
+       { CFG_GLOBAL, "tune.h2.header-table-size",      h2_parse_header_table_size      },
        { 0, NULL, NULL }
 }};