Hi,

I've been spending time writing tests for some other work I'm doing and I
found bereq.uncacheable being writable, which doesn't make much sense to me.

The same can be achieved setting beresp.uncacheable in vcl_backend_response
or vcl_backend_error so this duplication seems unnecessary and having a
single place to set whether the object is uncacheable is better.

Comments? OK?
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 07f386b..fe4fea8 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -204,20 +204,6 @@ VRT_r_beresp_##field(VRT_CTX)				\
 
 /*--------------------------------------------------------------------*/
 
-void
-VRT_l_bereq_uncacheable(VRT_CTX, unsigned a)
-{
-	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
-	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
-
-	if (ctx->bo->do_pass && !a) {
-		VSLb(ctx->vsl, SLT_VCL_Error,
-		    "Ignoring attempt to reset bereq.uncacheable");
-	} else if (a) {
-		ctx->bo->do_pass = 1;
-	}
-}
-
 unsigned
 VRT_r_bereq_uncacheable(VRT_CTX)
 {
diff --git a/bin/varnishtest/tests/v00025.vtc b/bin/varnishtest/tests/v00025.vtc
index 2ac4b9d..ffd622b 100644
--- a/bin/varnishtest/tests/v00025.vtc
+++ b/bin/varnishtest/tests/v00025.vtc
@@ -52,7 +52,6 @@ varnish v1 -arg "-i J.F.Nobody" -vcl+backend {
 	}
 
 	sub vcl_backend_fetch {
-		set bereq.uncacheable = false;
 		if (bereq.between_bytes_timeout < 10s) {
 			set bereq.http.quick = "please";
 		}
diff --git a/lib/libvcc/generate.py b/lib/libvcc/generate.py
index 4dd6288..75b1f9b 100755
--- a/lib/libvcc/generate.py
+++ b/lib/libvcc/generate.py
@@ -360,17 +360,10 @@ sp_variables = [
 	('bereq.uncacheable',
 		'BOOL',
 		( 'backend', ),
-		( 'backend_fetch', ), """
-		Indicates whether the object requested from the backend is
-		going to be uncacheable - either because the request was an
-		explicit pass from the client side or a hit on an uncacheable
-		("hit for pass") object.
-
-		Setting this variable in vcl_backend_fetch makes the object
-		uncacheable.
-
-		Clearing the variable has no effect and will log the warning
-		"Ignoring attempt to reset bereq.uncacheable".
+		( ), """
+		Indicates whether this request is uncacheable due
+		to a pass in the client side or a hit on an existing
+		uncacheable object (aka hit-for-pass).
 		"""
 	),
 	('bereq.connect_timeout',
_______________________________________________
varnish-dev mailing list
[email protected]
https://www.varnish-cache.org/lists/mailman/listinfo/varnish-dev

Reply via email to