Commit 9f72469f authored by Poul-Henning Kamp's avatar Poul-Henning Kamp Committed by Dridi Boukelmoune

Make VCC not fail if you try to pass STRANDS to STRING_LIST.

Strenghen the case against STRING_LIST in the docs.

See also: #2873

Conflicts:
	lib/libvmod_debug/vmod.vcc
parent d231464f
......@@ -120,3 +120,10 @@ varnish v1 -errvcl {Expression has type STRING, expected REAL} {
set resp.http.who = std.random("foo", "bar");
}
}
varnish v1 -errvcl {Cannot convert type STRING(STRANDS) to STRING(STRING_LIST)} {
import debug;
sub vcl_deliver {
set resp.http.who = debug.return_strands(req.url + "bar");
}
}
......@@ -390,9 +390,8 @@ STEVEDORE
STRING_LIST
C-type: ``const char *, ...``
`Notice: New vmod developments for 6.1 and higher should
consider STRANDS as a better alternative to STRING_LIST, which
will eventually be replaced entirely.`
`Notice: New vmod developments for 6.1 and later must
use STRANDS instead of STRING_LIST, which is going away.`
A multi-component text-string. We try very hard to avoid
doing text-processing in Varnish, and this is one way we
......
......@@ -1312,7 +1312,14 @@ vcc_expr0(struct vcc *tl, struct expr **e, vcc_type_t fmt)
else
vcc_expr_cor(tl, e, fmt);
ERRCHK(tl);
assert(!(*e)->fmt->stringform);
if ((*e)->fmt->stringform) {
VSB_printf(tl->sb, "Cannot convert type %s(%s) to %s(%s)\n",
vcc_utype((*e)->fmt), (*e)->fmt->name,
vcc_utype(fmt), fmt->name);
vcc_ErrWhere2(tl, t1, tl->t);
return;
}
if ((*e)->fmt != STRINGS && fmt->stringform)
vcc_expr_tostring(tl, e, STRINGS);
......
......@@ -217,6 +217,8 @@ $Method STRING .meth_opt(PRIV_CALL, PRIV_VCL, PRIV_TASK,
Test object method with all the fancy stuff.
$Function STRANDS return_strands(STRANDS strand)
$Function VOID store_ip(PRIV_TASK, IP)
Store an IP address to be later found by ``debug.get_ip()`` in the same
......
......@@ -548,3 +548,11 @@ xyzzy_get_ip(VRT_CTX, struct vmod_priv *priv)
return (ip);
}
VCL_STRANDS
xyzzy_return_strands(VRT_CTX, VCL_STRANDS strand)
{
CHECK_OBJ_NOTNULL(ctx, VRT_CTX_MAGIC);
return (strand);
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment