[master] f4e7c9674 Clear catflap when rolling back

Nils Goroll nils.goroll at uplex.de
Fri Dec 10 17:12:07 UTC 2021


commit f4e7c9674cd22249f64544b021fe681a341c7cb6
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Fri Dec 10 18:10:32 2021 +0100

    Clear catflap when rolling back
    
    Fixes #3752

diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index aae9be794..c827a0dec 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -235,6 +235,7 @@ Req_Rollback(VRT_CTX)
 		VCL_TaskEnter(req->top->privs);
 	HTTP_Clone(req->http, req->http0);
 	req->filter_list = NULL;
+	req->vcf = NULL;
 	if (WS_Overflowed(req->ws))
 		req->wrk->stats->ws_client_overflow++;
 	AN(req->ws_req);
diff --git a/bin/varnishtest/tests/m00051.vtc b/bin/varnishtest/tests/m00051.vtc
index 8d2ed69aa..2768e9504 100644
--- a/bin/varnishtest/tests/m00051.vtc
+++ b/bin/varnishtest/tests/m00051.vtc
@@ -2,6 +2,7 @@ varnishtest "catflap"
 
 varnish v1 -vcl {
 	import debug;
+	import std;
 
 	backend dummy { .host = "${bad_backend}"; }
 
@@ -15,6 +16,11 @@ varnish v1 -vcl {
 		} else if (req.http.novcf) {
 			set req.http.consume = "some workspace";
 			return (pass);
+		} else if (req.http.rollback) {
+			debug.catflap(first);
+			std.rollback(req);
+			set req.http.consume = "some workspace";
+			set req.http.consume = "some workspace";
 		} else {
 			return (fail);
 		}
@@ -71,6 +77,10 @@ client c1 {
 	rxresp
 	expect resp.status == 200
 	expect resp.http.id == "3"
+	txreq -hdr "rollback: yes"
+	rxresp
+	expect resp.status == 200
+	expect resp.http.id == "3"
 	txreq -hdr "novcf: yes"
 	rxresp
 	expect resp.status == 206


More information about the varnish-commit mailing list