[master] f1d7ca28b Permit subsequent conditional requests on 304

Federico G. Schwindt fgsch at lodoss.net
Thu Dec 27 17:13:04 UTC 2018


commit f1d7ca28be5ffba201cfe357b39261e7d25f5f18
Author: Federico G. Schwindt <fgsch at lodoss.net>
Date:   Thu Dec 27 17:10:20 2018 +0000

    Permit subsequent conditional requests on 304
    
    Fixes #2871.

diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 7bec80cb9..02ad2cc56 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -648,7 +648,8 @@ vbf_stp_condfetch(struct worker *wrk, struct busyobj *bo)
 		    OA_ESIDATA));
 
 	AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_FLAGS));
-	ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_IMSCAND, 0);
+	if (bo->fetch_objcore->flags & OC_F_HFM)
+		ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_IMSCAND, 0);
 	AZ(ObjCopyAttr(bo->wrk, bo->fetch_objcore, bo->stale_oc, OA_GZIPBITS));
 
 	if (bo->do_stream) {
diff --git a/bin/varnishtest/tests/b00039.vtc b/bin/varnishtest/tests/b00039.vtc
index b9d40bfeb..ba4285369 100644
--- a/bin/varnishtest/tests/b00039.vtc
+++ b/bin/varnishtest/tests/b00039.vtc
@@ -6,6 +6,9 @@ server s1 {
 	rxreq
 	expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT"
 	txresp -status 304
+	rxreq
+	expect req.http.if-modified-since == "Wed, 11 Sep 2013 13:36:55 GMT"
+	txresp -status 304
 } -start
 
 varnish v1 -vcl+backend {
@@ -44,3 +47,13 @@ client c1 {
 	expect resp.body == "Geoff Rules"
 	expect resp.http.was-304 == "true"
 } -run
+
+delay 1
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+	expect resp.body == "Geoff Rules"
+	expect resp.http.was-304 == "true"
+} -run


More information about the varnish-commit mailing list