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.
This commit is contained in:
Willy Tarreau 2017-07-27 11:42:14 +02:00
parent 62f5269d05
commit fe20e5b8c7
2 changed files with 28 additions and 0 deletions

View File

@ -599,6 +599,7 @@ The following keywords are supported in the "global" section :
- tune.bufsize - tune.bufsize
- tune.chksize - tune.chksize
- tune.comp.maxlevel - tune.comp.maxlevel
- tune.h2.header-table-size
- tune.http.cookielen - tune.http.cookielen
- tune.http.logurilen - tune.http.logurilen
- tune.http.maxhdr - tune.http.maxhdr
@ -1367,6 +1368,13 @@ tune.comp.maxlevel <number>
Each session using compression initializes the compression algorithm with Each session using compression initializes the compression algorithm with
this value. The default value is 1. 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> tune.http.cookielen <number>
Sets the maximum length of captured cookies. This is the maximum value that 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 the "capture cookie xxx len yyy" will be allowed to take, and any upper value

View File

@ -16,6 +16,10 @@
#include <proto/stream.h> #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 */ /* 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 */ /* 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 */ /* config keyword parsers */
static struct cfg_kw_list cfg_kws = {ILH, { static struct cfg_kw_list cfg_kws = {ILH, {
{ CFG_GLOBAL, "tune.h2.header-table-size", h2_parse_header_table_size },
{ 0, NULL, NULL } { 0, NULL, NULL }
}}; }};