[master] e296eea75 Clear the vcf pointer inbetween requests

Nils Goroll nils.goroll at uplex.de
Tue Dec 14 07:46:05 UTC 2021


commit e296eea75e61f2525b6801c000440eb2bb0b5541
Author: Nils Goroll <nils.goroll at uplex.de>
Date:   Tue Dec 14 08:26:04 2021 +0100

    Clear the vcf pointer inbetween requests
    
    Fixes #3755

diff --git a/bin/varnishd/cache/cache_req.c b/bin/varnishd/cache/cache_req.c
index c827a0dec..cf456c98f 100644
--- a/bin/varnishd/cache/cache_req.c
+++ b/bin/varnishd/cache/cache_req.c
@@ -288,6 +288,7 @@ Req_Cleanup(struct sess *sp, struct worker *wrk, struct req *req)
 	req->esi_level = 0;
 	req->is_hit = 0;
 	req->req_step = R_STP_TRANSPORT;
+	req->vcf = NULL;
 
 	if (WS_Overflowed(req->ws))
 		wrk->stats->ws_client_overflow++;
diff --git a/bin/varnishtest/tests/m00051.vtc b/bin/varnishtest/tests/m00051.vtc
index 5be0b4d79..ac596feb4 100644
--- a/bin/varnishtest/tests/m00051.vtc
+++ b/bin/varnishtest/tests/m00051.vtc
@@ -17,6 +17,11 @@ varnish v1 -vcl {
 		} else if (req.http.novcfpass) {
 			vtc.workspace_reserve(client, -1);
 			return (pass);
+		} else if (req.http.novcfmiss) {
+			vtc.workspace_reserve(client, -1);
+		} else if (req.http.vcfpass) {
+			debug.catflap(first);
+			return (pass);
 		} else if (req.http.rollback) {
 			debug.catflap(first);
 			std.rollback(req);
@@ -28,7 +33,7 @@ varnish v1 -vcl {
 	}
 
 	sub vcl_backend_error {
-		if (bereq.http.novcfpass) {
+		if (bereq.http.novcfpass || bereq.http.vcfpass) {
 			set beresp.status = 206;
 			return (deliver);
 		}
@@ -92,4 +97,16 @@ client c1 {
 	txreq -hdr "novcfpass: yes"
 	rxresp
 	expect resp.status == 206
+
+	# VCF with return(pass) must not leave the VCF dangling on the
+	# workspace for a subsequent plain miss
+
+	txreq -hdr "vcfpass: yes"
+	rxresp
+	expect resp.status == 206
+
+	txreq -hdr "novcfmiss: yes"
+	rxresp
+	expect resp.status == 200
+	expect resp.http.id == "3"
 } -run


More information about the varnish-commit mailing list