r4788 - in trunk/varnish-cache: bin/varnishtest/tests lib/libvcl

tfheen at varnish-cache.org tfheen at varnish-cache.org
Mon May 10 13:11:41 CEST 2010


Author: tfheen
Date: 2010-05-10 13:11:41 +0200 (Mon, 10 May 2010)
New Revision: 4788

Modified:
   trunk/varnish-cache/bin/varnishtest/tests/b00030.vtc
   trunk/varnish-cache/lib/libvcl/vcc_string.c
Log:
Add missing bits for string version of "now"


Modified: trunk/varnish-cache/bin/varnishtest/tests/b00030.vtc
===================================================================
--- trunk/varnish-cache/bin/varnishtest/tests/b00030.vtc	2010-05-09 23:15:19 UTC (rev 4787)
+++ trunk/varnish-cache/bin/varnishtest/tests/b00030.vtc	2010-05-10 11:11:41 UTC (rev 4788)
@@ -1,4 +1,6 @@
 # $Id$
+# We can't test the value of x-timestamp, but this should fail
+# if we can't set the header at all.
 
 test "Test formatting of timestamps"
 
@@ -11,6 +13,9 @@
 	sub vcl_recv {
 		error 200 req.grace;
 	}
+	sub vcl_error {
+		set obj.http.x-timestamp = now;
+	}
 } -start
 
 client c1 {

Modified: trunk/varnish-cache/lib/libvcl/vcc_string.c
===================================================================
--- trunk/varnish-cache/lib/libvcl/vcc_string.c	2010-05-09 23:15:19 UTC (rev 4787)
+++ trunk/varnish-cache/lib/libvcl/vcc_string.c	2010-05-10 11:11:41 UTC (rev 4788)
@@ -153,6 +153,11 @@
 		return (vcc_regsub(tl, 0));
 	if (tl->t->tok == ID && vcc_IdIs(tl->t, "regsuball"))
 		return (vcc_regsub(tl, 1));
+	if (tl->t->tok == ID && vcc_IdIs(tl->t, "now")) {
+		Fb(tl, 0, "VRT_time_string(sp, VRT_r_now(sp))");
+		vcc_NextToken(tl);
+		return 1;
+	}
 	if (tl->t->tok == VAR) {
 		vp = vcc_FindVar(tl, tl->t, vcc_vars, 0, "read");
 		if (tl->err)




More information about the varnish-commit mailing list