[master] f260415 Add a read-only beresp.filters variable which doesn't return that yet.

Poul-Henning Kamp phk at FreeBSD.org
Tue Apr 17 06:58:09 UTC 2018


commit f26041594540d65d69693b22ef7ca0ae6db78249
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Apr 16 15:36:16 2018 +0000

    Add a read-only beresp.filters variable which doesn't return that yet.

diff --git a/bin/varnishd/cache/cache.h b/bin/varnishd/cache/cache.h
index 582f70b..e1d835f 100644
--- a/bin/varnishd/cache/cache.h
+++ b/bin/varnishd/cache/cache.h
@@ -388,6 +388,7 @@ struct busyobj {
 	struct worker		*wrk;
 
 	struct vfp_ctx		*vfc;
+	char			*filter_list;
 
 	struct ws		ws[1];
 	uintptr_t		ws_bo;
diff --git a/bin/varnishd/cache/cache_vrt_var.c b/bin/varnishd/cache/cache_vrt_var.c
index 86df664..bb55018 100644
--- a/bin/varnishd/cache/cache_vrt_var.c
+++ b/bin/varnishd/cache/cache_vrt_var.c
@@ -36,6 +36,7 @@
 #include "common/heritage.h"
 
 #include "vcl.h"
+#include "vct.h"
 
 #include "cache_director.h"
 #include "vrt_obj.h"
@@ -913,3 +914,26 @@ HTTP_VAR(req)
 HTTP_VAR(resp)
 HTTP_VAR(bereq)
 HTTP_VAR(beresp)
+
+/*--------------------------------------------------------------------*/
+
+VCL_STRING
+VRT_r_beresp_filters(VRT_CTX)
+{
+	const char *p;
+
+	CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
+	CHECK_OBJ_NOTNULL(ctx->bo, BUSYOBJ_MAGIC);
+	if (ctx->bo->filter_list != NULL)
+		return(ctx->bo->filter_list);
+#if 1
+	p = "Not Yet";
+#else
+	p = VBF_Get_Filter_List(ctx->bo);
+	WS_Release(ctx->bo->ws, strlen(p) + 1);
+#endif
+	while(vct_isspace(*p))
+		p++;
+	return (p);
+}
+
diff --git a/bin/varnishtest/tests/a00000.vtc b/bin/varnishtest/tests/a00000.vtc
index 868fa54..ec84187 100644
--- a/bin/varnishtest/tests/a00000.vtc
+++ b/bin/varnishtest/tests/a00000.vtc
@@ -72,7 +72,7 @@ process p4 -need-bytes 310 -expect-text 3 1 "line3 <"
 process p4 -expect-cursor 4 1
 process p4 -expect-cursor 4 0
 process p4 -expect-cursor 0 1
-process p4 -screen-dump 
+process p4 -screen-dump
 
 # Also exercise CONS25 mode
 process p4 -write "\x1b[=1T"
diff --git a/bin/varnishtest/tests/e00023.vtc b/bin/varnishtest/tests/e00023.vtc
index 7d4aeaa..08517c6 100644
--- a/bin/varnishtest/tests/e00023.vtc
+++ b/bin/varnishtest/tests/e00023.vtc
@@ -37,7 +37,9 @@ server s1 {
 
 varnish v1 -vcl+backend {
 	sub vcl_backend_response {
+		set beresp.http.filter1 = beresp.filters;
 		set beresp.do_esi = true;
+		set beresp.http.filter2 = beresp.filters;
 	}
 } -start
 
diff --git a/bin/varnishtest/tests/e00028.vtc b/bin/varnishtest/tests/e00028.vtc
index 9a5fe16..bc25d68 100644
--- a/bin/varnishtest/tests/e00028.vtc
+++ b/bin/varnishtest/tests/e00028.vtc
@@ -36,12 +36,14 @@ server s1 {
 
 varnish v1 -arg "-p feature=+esi_disable_xml_check" -vcl+backend {
 	sub vcl_backend_response {
+		set beresp.http.filters1 = beresp.filters;
 		set beresp.do_esi = true;
 		if (bereq.url ~ "/baz") {
 			set beresp.do_gzip = true;
 		} elif (bereq.url ~ "/foo(bar|baz|qux)") {
 			set beresp.do_gunzip = true;
 		}
+		set beresp.http.filters2 = beresp.filters;
 	}
 } -start
 
diff --git a/doc/sphinx/reference/vcl_var.rst b/doc/sphinx/reference/vcl_var.rst
index 6df3635..f29a9ed 100644
--- a/doc/sphinx/reference/vcl_var.rst
+++ b/doc/sphinx/reference/vcl_var.rst
@@ -895,6 +895,14 @@ beresp.storage_hint	``VCL <= 4.0``
 	Hint to Varnish that you want to save this object to a
 	particular storage backend.
 
+beresp.filters
+
+	Type: STRING
+
+	Readable from: vcl_backend_response
+
+	List of VFP filters the beresp.body will be pulled through.
+	
 obj
 ~~~
 


More information about the varnish-commit mailing list