Commit 7192541d authored by Nils Goroll's avatar Nils Goroll

Revert "Expose is_hit to VCL as resp.is_hit"

This reverts commit 468a0472.

The next commit will make obj.hits reliable
parent 468a0472
......@@ -540,7 +540,7 @@ struct req {
int restarts;
int esi_level;
#define REQ_FLAG(l, o, r, w, d) unsigned l:1;
#define REQ_FLAG(l, r, w, d) unsigned l:1;
#include "tbl/req_flags.h"
#undef REQ_FLAG
......
......@@ -415,7 +415,7 @@ pan_req(const struct req *req)
}
VSB_printf(pan_vsp, " flags = {\n");
#define REQ_FLAG(l, o, r, w, d) if(req->l) VSB_printf(pan_vsp, " " #l ",\n");
#define REQ_FLAG(l, r, w, d) if(req->l) VSB_printf(pan_vsp, " " #l ",\n");
#include "tbl/req_flags.h"
#undef REQ_FLAG
VSB_printf(pan_vsp, " }\n");
......
......@@ -566,29 +566,29 @@ VRT_r_bereq_xid(VRT_CTX)
* req fields
*/
#define VREQW0(obj, field)
#define VREQW1(obj, field) \
#define VREQW0(field)
#define VREQW1(field) \
void \
VRT_l_##obj##_##field(VRT_CTX, unsigned a) \
VRT_l_req_##field(VRT_CTX, unsigned a) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
ctx->req->field = a ? 1 : 0; \
}
#define VREQR0(obj, field)
#define VREQR1(obj, field) \
#define VREQR0(field)
#define VREQR1(field) \
unsigned \
VRT_r_##obj##_##field(VRT_CTX) \
VRT_r_req_##field(VRT_CTX) \
{ \
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC); \
CHECK_OBJ_NOTNULL(ctx->req, REQ_MAGIC); \
return (ctx->req->field); \
}
#define REQ_FLAG(l, o, r, w, d) \
VREQR##r(o, l) \
VREQW##w(o, l)
#define REQ_FLAG(l, r, w, d) \
VREQR##r(l) \
VREQW##w(l)
#include "tbl/req_flags.h"
#undef REQ_FLAG
......
......@@ -13,11 +13,6 @@ varnish v1 -vcl+backend {
sub vcl_deliver {
set resp.http.foo = obj.hits;
if (resp.is_hit) {
set resp.http.X-Hit = "yes";
} else {
set resp.http.X-Hit = "no";
}
}
} -start
......@@ -26,19 +21,16 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.http.foo == 0
expect resp.http.X-hit == "no"
txreq
rxresp
expect resp.status == 200
expect resp.http.foo == 1
expect resp.http.X-hit == "yes"
txreq -url /foo
rxresp
expect resp.status == 200
expect resp.http.foo == 0
expect resp.http.X-hit == "no"
delay .1
txreq
......@@ -46,5 +38,4 @@ client c1 {
expect resp.status == 200
expect resp.http.foo == 2
expect resp.http.bar >= 0.100
expect resp.http.X-hit == "yes"
} -run
......@@ -13,11 +13,6 @@ varnish v1 \
-vcl+backend {
sub vcl_deliver {
set resp.http.hits = obj.hits;
if (resp.is_hit) {
set resp.http.X-Hit = "yes";
} else {
set resp.http.X-Hit = "no";
}
}
} -start
......@@ -28,7 +23,6 @@ client c1 {
expect resp.status == 200
expect resp.bodylen == 6
expect resp.http.hits == 0
expect resp.http.X-Hit == "no"
# This is a hit -> hits == 1
txreq -url "/" -hdr "Bar: 1"
......@@ -36,7 +30,6 @@ client c1 {
expect resp.status == 200
expect resp.bodylen == 6
expect resp.http.hits == 1
expect resp.http.X-Hit == "yes"
# This is a miss on different vary -> hits == 0
txreq -url "/" -hdr "Bar: 2"
......@@ -44,7 +37,6 @@ client c1 {
expect resp.status == 200
expect resp.bodylen == 4
expect resp.http.hits == 0
expect resp.http.X-Hit == "no"
# This is a hit -> hits == 1
txreq -url "/" -hdr "Bar: 2"
......@@ -52,7 +44,6 @@ client c1 {
expect resp.status == 200
expect resp.bodylen == 4
expect resp.http.hits == 1
expect resp.http.X-Hit == "yes"
} -run
......
......@@ -29,11 +29,11 @@
/*lint -save -e525 -e539 */
/* lower, vcl_obj, vcl_r, vcl_w, doc */
REQ_FLAG(disable_esi, none, 0, 0, "")
REQ_FLAG(hash_ignore_busy, req, 1, 1, "")
REQ_FLAG(hash_always_miss, req, 1, 1, "")
REQ_FLAG(is_hit, resp, 1, 0, "")
REQ_FLAG(wantbody, none, 0, 0, "")
REQ_FLAG(gzip_resp, none, 0, 0, "")
/* lower, vcl_r, vcl_w, doc */
REQ_FLAG(disable_esi, 0, 0, "")
REQ_FLAG(hash_ignore_busy, 1, 1, "")
REQ_FLAG(hash_always_miss, 1, 1, "")
REQ_FLAG(is_hit, 0, 0, "")
REQ_FLAG(wantbody, 0, 0, "")
REQ_FLAG(gzip_resp, 0, 0, "")
/*lint -restore */
......@@ -564,10 +564,8 @@ sp_variables = [
'INT',
( 'hit', 'deliver',),
( ), """
The count of cache-hits on this object.
NB: obj.hits is not a reliable way to determine cache
misses. See resp.is_hit.
The count of cache-hits on this object. A value of 0 indicates a
cache miss.
"""
),
('obj.http.',
......@@ -647,13 +645,6 @@ sp_variables = [
The corresponding HTTP header.
"""
),
('resp.is_hit',
'BOOL',
( 'deliver',),
( ), """
If this response is from a cache hit.
"""
),
('now',
'TIME',
( 'all',),
......
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