[6.0] cf444b4fb http2_session: Advertise http_req_size to clients

Dridi Boukelmoune dridi.boukelmoune at gmail.com
Thu Apr 4 14:33:11 UTC 2024


commit cf444b4fbe3d3ba85223a2a4d8a5d2b6d5326c27
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.
    
    Conflicts:
            bin/varnishtest/tests/t02000.vtc
            bin/varnishtest/tests/t02005.vtc
            include/tbl/params.h

diff --git a/bin/varnishd/http2/cache_http2_session.c b/bin/varnishd/http2/cache_http2_session.c
index 06e625f33..2cfba41ef 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 789b5d822..fb3eef341 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 9aff481c9..a705a8f70 100644
--- a/bin/varnishtest/tests/t02005.vtc
+++ b/bin/varnishtest/tests/t02005.vtc
@@ -27,7 +27,7 @@ varnish v1 -cliok "param.set debug +syncvsl"
 
 logexpect l1 -v v1 -g raw {
 	expect	* 1001 ReqAcct	"80 7 87 106 8 114"
-	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 c382e862d..a81a46d48 100644
--- a/include/tbl/h2_settings.h
+++ b/include/tbl/h2_settings.h
@@ -90,6 +90,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,
@@ -99,6 +100,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 5ec1ec821..7c3945d33 100644
--- a/include/tbl/params.h
+++ b/include/tbl/params.h
@@ -703,11 +703,13 @@ PARAM(
 	/* flags */	0,
 	/* s-text */
 	"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.",
 	/* l-text */	"",
 	/* func */	NULL
 )
@@ -1899,7 +1901,9 @@ PARAM(
 	/* units */     "bytes",
 	/* flags */     0,
 	/* s-text */
-	"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.",
 	/* l-text */    "",
 	/* func */      NULL
 )


More information about the varnish-commit mailing list