> Either way, it might be ok, no further opinion really.
New patch based on your feedback :)
From c37e42788ad53c49cb8ff1a121aacef6ed71935a Mon Sep 17 00:00:00 2001
From: Dridi Boukelmoune <[email protected]>
Date: Fri, 11 Sep 2015 15:57:49 +0200
Subject: [PATCH] Log 'set beresp.uncacheable = true' occurrences
---
bin/varnishd/cache/cache_fetch.c | 7 ++++++-
bin/varnishd/cache/cache_vrt_var.c | 1 +
bin/varnishtest/tests/v00045.vtc | 35 +++++++++++++++++++++++++++++++++++
include/tbl/vsl_tags.h | 4 ++++
4 files changed, 46 insertions(+), 1 deletion(-)
create mode 100644 bin/varnishtest/tests/v00045.vtc
diff --git a/bin/varnishd/cache/cache_fetch.c b/bin/varnishd/cache/cache_fetch.c
index 539fee1..4e6fd42 100644
--- a/bin/varnishd/cache/cache_fetch.c
+++ b/bin/varnishd/cache/cache_fetch.c
@@ -112,6 +112,7 @@ vbf_beresp2obj(struct busyobj *bo)
"Illegal 'Vary' header from backend, "
"making this a pass.");
bo->uncacheable = 1;
+ VSLb(bo->vsl, SLT_Uncacheable, "Illegal Vary header");
AZ(vary);
} else
/* No vary */
@@ -273,7 +274,11 @@ vbf_stp_startfetch(struct worker *wrk, struct busyobj *bo)
VCL_backend_fetch_method(bo->vcl, wrk, NULL, bo, NULL);
- bo->uncacheable = bo->do_pass;
+ if (bo->do_pass) {
+ bo->uncacheable = 1;
+ VSLb(bo->vsl, SLT_Uncacheable, "bereq");
+ }
+
if (wrk->handling == VCL_RET_ABANDON)
return (F_STP_FAIL);
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index c51007b..2b52739 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -221,6 +221,7 @@ VRT_l_beresp_uncacheable(VRT_CTX, unsigned a)
"Ignoring attempt to reset beresp.uncacheable");
} else if (a) {
ctx->bo->uncacheable = 1;
+ VSLb(ctx->vsl, SLT_Uncacheable, "VCL");
}
}
diff --git a/bin/varnishtest/tests/v00045.vtc b/bin/varnishtest/tests/v00045.vtc
new file mode 100644
index 0000000..7d1bead
--- /dev/null
+++ b/bin/varnishtest/tests/v00045.vtc
@@ -0,0 +1,35 @@
+varnishtest "Log when beresp is made uncacheable"
+
+server s1 {
+ rxreq
+ txresp -hdr "Cache-Control: no-cache"
+
+ rxreq
+ txresp
+
+ rxreq
+ txresp -hdr "Vary: bogo header"
+} -start
+
+varnish v1 -vcl+backend "" -start
+
+logexpect l1 -v v1 -g session {
+ expect * 1002 Uncacheable VCL
+ expect * 1004 Uncacheable bereq
+ expect * 1004 Uncacheable VCL
+ expect * 1006 Uncacheable "Illegal Vary header"
+} -start
+
+client c1 {
+ txreq
+ rxresp
+
+ # hitpass
+ txreq
+ rxresp
+
+ txreq -url "/vary"
+ rxresp
+} -run
+
+logexpect l1 -wait
diff --git a/include/tbl/vsl_tags.h b/include/tbl/vsl_tags.h
index 56a9604..98354f0 100644
--- a/include/tbl/vsl_tags.h
+++ b/include/tbl/vsl_tags.h
@@ -522,5 +522,9 @@ SLTM(Witness, 0, "Lock order witness records",
"Diagnostic recording of locking order.\n"
)
+SLTM(Uncacheable, 0, "Uncacheable object",
+ "Backend response marked as uncacheable.\n"
+)
+
#undef NODEF_NOTICE
/*lint -restore */
--
2.4.3
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev