[experimental-ims] 9d0e486 Don't consider a vcc expr to be constant after vcc_expr_tostring.

Martin Blix Grydeland martin at varnish-software.com
Thu Dec 18 10:27:46 CET 2014


commit 9d0e486fe21199e6c059eb829f5d666611806012
Author: Martin Blix Grydeland <martin at varnish-software.com>
Date:   Tue May 8 14:20:42 2012 +0200

    Don't consider a vcc expr to be constant after vcc_expr_tostring.
    
    Avoids vcc errors from constructs like "std.log("Test: " + 1);"
    
    Fixes: #1134

diff --git a/bin/varnishtest/tests/r01134.vtc b/bin/varnishtest/tests/r01134.vtc
new file mode 100644
index 0000000..73f4e36
--- /dev/null
+++ b/bin/varnishtest/tests/r01134.vtc
@@ -0,0 +1,19 @@
+varnishtest "vcc const/non-const tostring conversion - bug 1134"
+
+server s1 {
+	rxreq
+	txresp
+} -start
+
+varnish v1 -vcl+backend {
+	sub vcl_recv {
+		set req.http.x-test = "Test " + 1;
+	}
+} -start
+
+client c1 {
+	txreq
+	rxresp
+	expect resp.status == 200
+} -run
+
diff --git a/lib/libvcl/vcc_expr.c b/lib/libvcl/vcc_expr.c
index 30e63d9..19a455c 100644
--- a/lib/libvcl/vcc_expr.c
+++ b/lib/libvcl/vcc_expr.c
@@ -434,8 +434,10 @@ vcc_expr_tostring(struct expr **e, enum var_type fmt)
 	case TIME:	p = "VRT_time_string(sp, \v1)"; break;
 	default:	break;
 	}
-	if (p != NULL)
+	if (p != NULL) {
 		*e = vcc_expr_edit(fmt, p, *e, NULL);
+		(*e)->constant = 0;
+	}
 }
 
 /*--------------------------------------------------------------------



More information about the varnish-commit mailing list