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