[master] 8a1948fa2 BLOBs have a .tostring now, but test other type which do not.

Poul-Henning Kamp phk at FreeBSD.org
Fri May 7 09:32:04 UTC 2021


commit 8a1948fa2b11a8f9d4ba2f81bf719f60ade3da36
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Fri May 7 09:16:05 2021 +0000

    BLOBs have a .tostring now, but test other type which do not.

diff --git a/bin/varnishtest/tests/v00020.vtc b/bin/varnishtest/tests/v00020.vtc
index 68570d106..ac60663aa 100644
--- a/bin/varnishtest/tests/v00020.vtc
+++ b/bin/varnishtest/tests/v00020.vtc
@@ -388,6 +388,10 @@ varnish v1 -errvcl {Symbol 'acl' has wrong type (reserved), expected acl:} {
 	sub vcl_recv { if (client.ip ~ acl) {} }
 }
 
+varnish v1 -errvcl {Cannot convert HTTP to STRING} {
+	sub vcl_synth { set resp.http.foo = resp; }
+}
+
 server s1 {
 	rxreq
 	txresp -hdr "bar: X"
diff --git a/lib/libvcc/vcc_expr.c b/lib/libvcc/vcc_expr.c
index 9b30c438a..3a762a1ee 100644
--- a/lib/libvcc/vcc_expr.c
+++ b/lib/libvcc/vcc_expr.c
@@ -288,15 +288,9 @@ vcc_expr_tostring(struct vcc *tl, struct expr **e, vcc_type_t fmt)
 		(*e)->constant = constant;
 		(*e)->nstr = 1;
 	} else {
-		if ((*e)->fmt == BLOB)
-			VSB_cat(tl->sb,
-			    "Wrong use of BLOB value.\n"
-			    "BLOBs can only be used as arguments to VMOD"
-			    " functions.\n");
-		else
-			VSB_printf(tl->sb,
-			    "Cannot convert %s to STRING.\n",
-			    vcc_utype((*e)->fmt));
+		VSB_printf(tl->sb,
+		    "Cannot convert %s to STRING.\n",
+		    vcc_utype((*e)->fmt));
 		vcc_ErrWhere2(tl, (*e)->t1, tl->t);
 	}
 }


More information about the varnish-commit mailing list