[4.0] 2eabf10 Require the "synthetic" argument to be function-like:

Poul-Henning Kamp phk at FreeBSD.org
Thu Mar 13 10:24:31 CET 2014


commit 2eabf10ffa3b7d8c75bf01336f671e872a2832ca
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Mar 10 20:27:12 2014 +0000

    Require the "synthetic" argument to be function-like:
    
    	synthetic ( STRING_LIST ) ;

diff --git a/bin/varnishd/builtin.vcl b/bin/varnishd/builtin.vcl
index a0eb015..96d74ea 100644
--- a/bin/varnishd/builtin.vcl
+++ b/bin/varnishd/builtin.vcl
@@ -137,7 +137,7 @@ sub vcl_deliver {
 sub vcl_error {
     set obj.http.Content-Type = "text/html; charset=utf-8";
     set obj.http.Retry-After = "5";
-    synthetic {"
+    synthetic( {"
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -154,7 +154,7 @@ sub vcl_error {
     <p>Varnish cache server</p>
   </body>
 </html>
-"};
+"} );
     return (deliver);
 }
 
@@ -184,7 +184,7 @@ sub vcl_backend_response {
 sub vcl_backend_error {
     set beresp.http.Content-Type = "text/html; charset=utf-8";
     set beresp.http.Retry-After = "5";
-    synthetic {"
+    synthetic( {"
 <?xml version="1.0" encoding="utf-8"?>
 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
@@ -201,7 +201,7 @@ sub vcl_backend_error {
     <p>Varnish cache server</p>
   </body>
 </html>
-"};
+"} );
     return (deliver);
 }
 
diff --git a/bin/varnishtest/tests/b00017.vtc b/bin/varnishtest/tests/b00017.vtc
index 0912e64..faac1e8 100644
--- a/bin/varnishtest/tests/b00017.vtc
+++ b/bin/varnishtest/tests/b00017.vtc
@@ -9,7 +9,7 @@ varnish v1 -vcl {
 	}
 
 	sub vcl_error {
-		synthetic "Custom vcl_error's synth output";
+		synthetic("Custom vcl_error's synth output");
 		return (deliver);
 	}
 } -start
diff --git a/bin/varnishtest/tests/r00936.vtc b/bin/varnishtest/tests/r00936.vtc
index 99e1d65..7e6ad64 100644
--- a/bin/varnishtest/tests/r00936.vtc
+++ b/bin/varnishtest/tests/r00936.vtc
@@ -9,7 +9,8 @@ varnish v1 -errvcl {'synthetic': not a valid action in method 'vcl_recv'} {
 	backend foo { .host = "127.0.0.1"; }
 
 	sub vcl_recv {
-		synthetic "HELLOO"; return (error(503));
+		synthetic("HELLOO");
+		return (error(503));
 	}
 }
 
diff --git a/bin/varnishtest/tests/r01287.vtc b/bin/varnishtest/tests/r01287.vtc
index 8560ce3..fc1ebd2 100644
--- a/bin/varnishtest/tests/r01287.vtc
+++ b/bin/varnishtest/tests/r01287.vtc
@@ -8,7 +8,7 @@ varnish v1 -vcl+backend {
 		return (error(200, "OK"));
 	}
 	sub vcl_error {
-		synthetic obj.http.blank;
+		synthetic(obj.http.blank);
 		return (deliver);
 	}
 } -start
diff --git a/bin/varnishtest/tests/v00018.vtc b/bin/varnishtest/tests/v00018.vtc
index 720c816..9e97762 100644
--- a/bin/varnishtest/tests/v00018.vtc
+++ b/bin/varnishtest/tests/v00018.vtc
@@ -100,7 +100,7 @@ varnish v1 -errvcl {Expected an action, 'if', '{' or '}'} {
 
 varnish v1 -errvcl {Unknown token '<<' when looking for STRING_LIST} {
 	backend b { .host = "127.0.0.1"; }
-	sub vcl_error { synthetic << "foo"; }
+	sub vcl_error { synthetic( << "foo"; }
 }
 
 varnish v1 -errvcl {Syntax has changed, use:} {
diff --git a/lib/libvcc/vcc_action.c b/lib/libvcc/vcc_action.c
index ff5f0f4..4e3f12c 100644
--- a/lib/libvcc/vcc_action.c
+++ b/lib/libvcc/vcc_action.c
@@ -396,10 +396,18 @@ parse_synthetic(struct vcc *tl)
 {
 	vcc_NextToken(tl);
 
+	ExpectErr(tl, '(');
+	ERRCHK(tl);
+	vcc_NextToken(tl);
+
 	Fb(tl, 1, "VRT_synth_page(ctx, ");
 	vcc_Expr(tl, STRING_LIST);
 	ERRCHK(tl);
 	Fb(tl, 0, ");\n");
+
+	ExpectErr(tl, ')');
+	vcc_NextToken(tl);
+	ERRCHK(tl);
 }
 
 /*--------------------------------------------------------------------*/



More information about the varnish-commit mailing list