From: Willy Tarreau Date: Thu, 27 Jul 2017 09:42:14 +0000 (+0200) Subject: MINOR: h2: expose tune.h2.header-table-size to configure the table size X-Git-Tag: v1.8-rc1~68 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fe20e5b8c706cf6393a7cd37e89d54ec5e1b23d5;p=thirdparty%2Fhaproxy.git MINOR: h2: expose tune.h2.header-table-size to configure the table size It's the HPACK header table size which is to be advertised in the settings frames. It defaults to 4096. --- diff --git a/doc/configuration.txt b/doc/configuration.txt index 0ef8103a63..5543f4c8d4 100644 --- a/doc/configuration.txt +++ b/doc/configuration.txt @@ -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 Each session using compression initializes the compression algorithm with this value. The default value is 1. +tune.h2.header-table-size + 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 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 diff --git a/src/mux_h2.c b/src/mux_h2.c index a15e4c7236..3fbac8c003 100644 --- a/src/mux_h2.c +++ b/src/mux_h2.c @@ -16,6 +16,10 @@ #include +/* 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 } }};