[refs/tags/varnish-7.7.0] bb7a91861 Dont attempt to process the H2-upgrade settings header until we are in H2 mode.
Walid Boudebouda
walid.boudebouda at gmail.com
Tue Mar 18 13:13:04 UTC 2025
commit bb7a918611ee85d17aefd07115fb8c66015151b5
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date: Mon Mar 17 16:46:45 2025 +0000
Dont attempt to process the H2-upgrade settings header until we
are in H2 mode.
Fixes: #4298
diff --git a/bin/varnishtest/tests/r04298.vtc b/bin/varnishtest/tests/r04298.vtc
new file mode 100644
index 000000000..a794cf182
--- /dev/null
+++ b/bin/varnishtest/tests/r04298.vtc
@@ -0,0 +1,21 @@
+varnishtest "Test HPACK dictionary sizing in upgrade settings"
+
+server s1 {
+ rxreq
+ upgrade
+ stream 1 {
+ rxreq
+ txresp
+ } -run
+
+} -start
+
+client c1 -connect ${s1_sock} {
+ txreq -up AAMAAABkAAQAAP__AAkAAAAB
+ stream 1 {
+ txreq
+ rxresp
+ } -run
+} -run
+
+server s1 -wait
diff --git a/bin/varnishtest/vtc_http.c b/bin/varnishtest/vtc_http.c
index 0f57aada6..4ed2be366 100644
--- a/bin/varnishtest/vtc_http.c
+++ b/bin/varnishtest/vtc_http.c
@@ -1058,8 +1058,6 @@ cmd_http_upgrade(CMD_ARGS)
" -hdr \"Upgrade: h2c\"\n"
);
- b64_settings(hp, h);
-
parse_string(vl, hp,
"rxpri\n"
"stream 0 {\n"
@@ -1070,6 +1068,9 @@ cmd_http_upgrade(CMD_ARGS)
" expect settings.ack == true\n"
"} -start\n"
);
+
+ b64_settings(hp, h);
+
}
/**********************************************************************
diff --git a/bin/varnishtest/vtc_http2.c b/bin/varnishtest/vtc_http2.c
index f89bb187e..822abbae1 100644
--- a/bin/varnishtest/vtc_http2.c
+++ b/bin/varnishtest/vtc_http2.c
@@ -2892,10 +2892,16 @@ b64_settings(const struct http *hp, const char *s)
buf = "unknown";
if (v == 1) {
- if (hp->sfd)
- assert(HPK_ResizeTbl(hp->encctx, v) != hpk_err);
- else
- assert(HPK_ResizeTbl(hp->decctx, v) != hpk_err);
+ enum hpk_result hrs;
+ if (hp->sfd) {
+ AN(hp->encctx);
+ hrs = HPK_ResizeTbl(hp->encctx, v);
+ } else {
+ AN(hp->decctx);
+ hrs = HPK_ResizeTbl(hp->decctx, v);
+ }
+ if (hrs != hpk_done)
+ vtc_fatal(hp->vl, "HPK resize failed %d\n", hrs);
}
vtc_log(hp->vl, 4, "Upgrade: %s (%d): %ju",
More information about the varnish-commit
mailing list