Commit 00bcc3ea authored by Federico G. Schwindt's avatar Federico G. Schwindt

Convert arguments to strings as well

This is consistent with what we do in other cases.
parent acdaa4bd
......@@ -5,6 +5,8 @@ server s1 {
txresp -hdr "Foo: 1" -body "1"
rxreq
txresp -hdr "Foo: 3" -body "3"
rxreq
txresp -hdr "Foo: 9" -body "9"
} -start
server s2 {
......@@ -28,19 +30,18 @@ varnish v1 -vcl+backend {
}
sub vcl_recv {
return(pass);
}
sub vcl_backend_fetch {
if (bereq.url == "/nohdr") {
set bereq.backend = h1.backend(bereq.http.Void);
} else if (bereq.url == "/emptystring") {
set bereq.backend = h1.backend("");
} else if (bereq.url == "/13") {
set bereq.backend = h1.backend(bereq.http.Void + "" + bereq.url);
if (req.url == "/nohdr") {
set req.backend_hint = h1.backend(req.http.Void);
} else if (req.url == "/emptystring") {
set req.backend_hint = h1.backend("");
} else if (req.url == "/13") {
set req.backend_hint = h1.backend(req.http.Void + "" + req.url);
} else if (req.url == "/ip") {
set req.backend_hint = h1.backend(client.ip);
} else {
set bereq.backend = h1.backend(bereq.url);
set req.backend_hint = h1.backend(req.url);
}
return (pass);
}
} -start
......@@ -68,4 +69,8 @@ client c1 {
txreq -url /nohdr
rxresp
expect resp.http.foo == "8"
txreq -url /ip
rxresp
expect resp.http.foo == "9"
} -run
......@@ -626,6 +626,9 @@ vcc_do_arg(struct vcc *tl, struct func_arg *fa)
} else {
vcc_expr0(tl, &e2, fa->type);
ERRCHK(tl);
if (e2->fmt != fa->type &&
(fa->type == STRING || fa->type == STRING_LIST))
vcc_expr_tostring(tl, &e2, fa->type);
if (e2->fmt != fa->type) {
VSB_printf(tl->sb, "Wrong argument type.");
VSB_printf(tl->sb, " Expected %s.",
......
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