Commit 76fc17c1 authored by Poul-Henning Kamp's avatar Poul-Henning Kamp

Make sure that the arguments we pass regsub() came out as strings.

Fixes #921
parent cfad4788
varnishtest "VCC type issue in regsub arg 1"
server s1 {
rxreq
expect req.http.foo == "127.0.0.1"
expect req.http.bar == "127.0.0.1"
txresp
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
set req.http.bar = regsub(req.url, ".*", client.ip);
set req.http.foo = regsub(client.ip, ":.*", client.ip);
}
} -start
client c1 {
txreq -url "/"
rxresp
expect resp.status == 200
} -run
......@@ -454,6 +454,8 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
SkipToken(tl, '(');
vcc_expr0(tl, &e2, STRING);
if (e2->fmt != STRING)
vcc_expr_tostring(&e2, STRING);
SkipToken(tl, ',');
ExpectErr(tl, CSTR);
......@@ -465,6 +467,8 @@ vcc_Eval_Regsub(struct vcc *tl, struct expr **e, const struct symbol *sym)
SkipToken(tl, ',');
vcc_expr0(tl, &e2, STRING);
if (e2->fmt != STRING)
vcc_expr_tostring(&e2, STRING);
*e = vcc_expr_edit(STRING, "\v1, \v2)", *e, e2);
SkipToken(tl, ')');
}
......
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