[master] f1fb85fed http2_session: Advertise http_req_size to clients

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 4 14:29:13 UTC 2024


commit f1fb85fed1f943a2005d7da06de94ff6fa6cc0e2
Author: Dridi Boukelmoune <dridi.boukelmoune at gmail.com>
Date:   Thu Mar 28 16:35:52 2024 +0100

    http2_session: Advertise http_req_size to clients
    
    Since http_req_size was already established for this purpose, and is
    now enforced for h2 traffic, it should naturally become the basis for
    the MAX_HEADER_LIST_SIZE setting in the initial SETTINGS frame sent
    to clients.
    
    The h2_max_header_list_size parameter will grow a new purpose.

diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index acbfdbb51..605798810 100644
--- a/bin/varnishd/http2/cache_http2_session.c
+++ b/bin/varnishd/http2/cache_http2_session.c
@@ -85,6 +85,7 @@ h2_local_settings(struct h2_settings *h2s)
 	h2s->l = cache_param->h2_##l;
 #include "tbl/h2_settings.h"
 #undef H2_SETTINGS_PARAM_ONLY
+	h2s->max_header_list_size = cache_param->http_req_size;
 }
 
 /**********************************************************************
diff --git a/bin/varnishtest/tests/t02000.vtc b/bin/varnishtest/tests/t02000.vtc
index a139cc33a..97120a9e7 100644
--- a/bin/varnishtest/tests/t02000.vtc
+++ b/bin/varnishtest/tests/t02000.vtc
@@ -69,7 +69,7 @@ varnish v1 -expect MEMPOOL.sess1.live == 0
 process p1 -stop
 # shell {cat ${tmpdir}/vlog}
 # SETTINGS with default initial window size
-shell -match {1001 H2TxHdr        c \[000006040000000000\]} {
+shell -match {1001 H2TxHdr        c \[00000c040000000000\]} {
 	cat ${tmpdir}/vlog
 }
 
diff --git a/bin/varnishtest/tests/t02005.vtc b/bin/varnishtest/tests/t02005.vtc
index c5176f725..39737f93a 100644
--- a/bin/varnishtest/tests/t02005.vtc
+++ b/bin/varnishtest/tests/t02005.vtc
@@ -32,7 +32,7 @@ varnish v1 -cliok "param.set debug +syncvsl"
 
 logexpect l1 -v v1 -g raw {
 	expect	* 1001 ReqAcct	"80 7 87 78 8 86"
-	expect	* 1000 ReqAcct	"45 8 53 63 28 91"
+	expect	* 1000 ReqAcct	"45 8 53 63 34 97"
 } -start
 
 client c1 {
diff --git a/include/tbl/h2_settings.h b/include/tbl/h2_settings.h
index 6c4520711..2dbac671f 100644
--- a/include/tbl/h2_settings.h
+++ b/include/tbl/h2_settings.h
@@ -92,6 +92,7 @@ H2_SETTING(					// rfc7540,l,2150,2157
 	H2CE_PROTOCOL_ERROR
 )
 
+#ifndef H2_SETTINGS_PARAM_ONLY
 H2_SETTING(					// rfc7540,l,2159,2167
 	MAX_HEADER_LIST_SIZE,
 	max_header_list_size,
@@ -101,6 +102,7 @@ H2_SETTING(					// rfc7540,l,2159,2167
 	0xffffffff,
 	0
 )
+#endif
 #undef H2_SETTING
 
 /*lint -restore */
diff --git a/include/tbl/params.h b/include/tbl/params.h
index 647ff7e87..124826805 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -605,11 +605,13 @@ PARAM_SIMPLE(
 	/* units */	"bytes",
 	/* descr */
 	"Maximum number of bytes of HTTP client request we will deal with. "
-	" This is a limit on all bytes up to the double blank line which "
-	"ends the HTTP request.\n"
+	"This is a limit on all bytes up to the double blank line which "
+	"ends the HTTP request. "
 	"The memory for the request is allocated from the client workspace "
 	"(param: workspace_client) and this parameter limits how much of "
-	"that the request is allowed to take up."
+	"that the request is allowed to take up.\n\n"
+	"For HTTP2 clients, it is advertised as MAX_HEADER_LIST_SIZE in "
+	"the initial SETTINGS frame."
 )
 
 PARAM_SIMPLE(
@@ -1290,7 +1292,9 @@ PARAM_SIMPLE(
 	/* def */	"4294967295b",
 	/* units */	"bytes",
 	/* descr */
-	"HTTP2 maximum size of an uncompressed header list."
+	"HTTP2 maximum size of an uncompressed header list. This parameter "
+	"is not mapped to " H2_SETTING_NAME(MAX_HEADER_LIST_SIZE) " in the "
+	"initial SETTINGS frame, the http_req_size parameter is instead."
 )
 
 #undef H2_SETTING_DESCR


More information about the varnish-commit mailing list