add bereq.is_hitpass and bereq.is_hitmiss

as copies of the respective client side flags
parent 8afbf7f6
...@@ -1114,6 +1114,9 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc, ...@@ -1114,6 +1114,9 @@ VBF_Fetch(struct worker *wrk, struct req *req, struct objcore *oc,
WRONG("Wrong fetch mode"); WRONG("Wrong fetch mode");
} }
bo->is_hitpass = req->is_hitpass;
bo->is_hitmiss = req->is_hitmiss;
VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how); VSLb(bo->vsl, SLT_Begin, "bereq %u %s", VXID(req->vsl->wid), how);
VSLb(bo->vsl, SLT_VCL_use, "%s", VCL_Name(bo->vcl)); VSLb(bo->vsl, SLT_VCL_use, "%s", VCL_Name(bo->vcl));
VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how); VSLb(req->vsl, SLT_Link, "bereq %u %s", VXID(bo->vsl->wid), how);
......
...@@ -53,6 +53,8 @@ server s1 { ...@@ -53,6 +53,8 @@ server s1 {
varnish v1 \ varnish v1 \
-arg "-s default,1m" -vcl+backend { -arg "-s default,1m" -vcl+backend {
sub vcl_backend_response { sub vcl_backend_response {
set beresp.http.be-hitmiss = bereq.is_hitmiss;
set beresp.http.be-hitpass = bereq.is_hitpass;
if (bereq.url == "/hfp") { if (bereq.url == "/hfp") {
return (pass(10m)); return (pass(10m));
} }
...@@ -75,6 +77,8 @@ client c1 { ...@@ -75,6 +77,8 @@ client c1 {
expect resp.bodylen == 65536 expect resp.bodylen == 65536
expect resp.http.is-hitmiss == false expect resp.http.is-hitmiss == false
expect resp.http.is-hitpass == false expect resp.http.is-hitpass == false
expect resp.http.be-hitmiss == resp.http.is-hitmiss
expect resp.http.be-hitpass == resp.http.is-hitpass
expect_pattern expect_pattern
} -start } -start
...@@ -98,6 +102,8 @@ client c1 { ...@@ -98,6 +102,8 @@ client c1 {
expect resp.bodylen == 65536 expect resp.bodylen == 65536
expect resp.http.is-hitmiss == true expect resp.http.is-hitmiss == true
expect resp.http.is-hitpass == false expect resp.http.is-hitpass == false
expect resp.http.be-hitmiss == resp.http.is-hitmiss
expect resp.http.be-hitpass == resp.http.is-hitpass
expect_pattern expect_pattern
} -start } -start
...@@ -122,6 +128,8 @@ client c1 { ...@@ -122,6 +128,8 @@ client c1 {
expect resp.bodylen == 65536 expect resp.bodylen == 65536
expect resp.http.is-hitmiss == false expect resp.http.is-hitmiss == false
expect resp.http.is-hitpass == false expect resp.http.is-hitpass == false
expect resp.http.be-hitmiss == resp.http.is-hitmiss
expect resp.http.be-hitpass == resp.http.is-hitpass
expect_pattern expect_pattern
} -start } -start
...@@ -145,6 +153,8 @@ client c1 { ...@@ -145,6 +153,8 @@ client c1 {
expect resp.bodylen == 65536 expect resp.bodylen == 65536
expect resp.http.is-hitmiss == false expect resp.http.is-hitmiss == false
expect resp.http.is-hitpass == true expect resp.http.is-hitpass == true
expect resp.http.be-hitmiss == resp.http.is-hitmiss
expect resp.http.be-hitpass == resp.http.is-hitpass
expect_pattern expect_pattern
} -start } -start
......
...@@ -650,6 +650,22 @@ bereq.is_bgfetch ...@@ -650,6 +650,22 @@ bereq.is_bgfetch
grace, and this fetch was kicked of in the background to get grace, and this fetch was kicked of in the background to get
a fresh copy. a fresh copy.
bereq.is_hitmiss
Type: BOOL
Readable from: backend
If this backend request was caused by a hitmiss.
bereq.is_hitpass
Type: BOOL
Readable from: backend
If this backend request was caused by a hitpass.
beresp beresp
~~~~~~ ~~~~~~
......
...@@ -43,6 +43,8 @@ BO_FLAG(do_pass, 0, 0, 0, 0, "") ...@@ -43,6 +43,8 @@ BO_FLAG(do_pass, 0, 0, 0, 0, "")
BO_FLAG(uncacheable, 0, 0, 0, 0, "") BO_FLAG(uncacheable, 0, 0, 0, 0, "")
BO_FLAG(was_304, 0, 1, 0, 0, "") BO_FLAG(was_304, 0, 1, 0, 0, "")
BO_FLAG(is_bgfetch, 1, 0, 0, 0, "") BO_FLAG(is_bgfetch, 1, 0, 0, 0, "")
BO_FLAG(is_hitmiss, 1, 0, 0, 0, "")
BO_FLAG(is_hitpass, 1, 0, 0, 0, "")
#undef BO_FLAG #undef BO_FLAG
/*lint -restore */ /*lint -restore */
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