Commit 4f2af500 authored by Martin Blix Grydeland's avatar Martin Blix Grydeland

Hit-for-pass objects are not IMS candidates

Original test case by fgsch

Fixes: #1858
parent 1f6e7cd4
......@@ -644,9 +644,10 @@ vbf_stp_fetch(struct worker *wrk, struct busyobj *bo)
if (bo->do_gzip || bo->do_gunzip)
ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_CHGGZIP, 1);
if (http_IsStatus(bo->beresp, 200) && (
http_GetHdr(bo->beresp, H_Last_Modified, &p) ||
http_GetHdr(bo->beresp, H_ETag, &p)))
if (!(bo->fetch_objcore->flags & OC_F_PASS) &&
http_IsStatus(bo->beresp, 200) && (
http_GetHdr(bo->beresp, H_Last_Modified, &p) ||
http_GetHdr(bo->beresp, H_ETag, &p)))
ObjSetFlag(bo->wrk, bo->fetch_objcore, OF_IMSCAND, 1);
if (bo->htc->body_status != BS_NONE)
......
varnishtest "Test a hit-for-pass does not issue an IMS request"
server s1 {
rxreq
txresp \
-hdr {Etag: "foo"} \
-body "foo"
rxreq
expect req.http.if-none-match == <undef>
txresp \
-hdr {Etag: "bar"} \
-body "bar"
} -start
varnish v1 -vcl+backend {
sub vcl_backend_response {
if (beresp.status == 200) {
set beresp.ttl = 1s;
set beresp.uncacheable = true;
return (deliver);
}
}
} -start
client c1 {
txreq
rxresp
expect resp.status == 200
expect resp.body == "foo"
delay 1.5
txreq
rxresp
expect resp.status == 200
expect resp.body == "bar"
} -run
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment