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

Handle string literal concatenation correctly.

Fixes #2685
parent 79c9415f
...@@ -10,6 +10,8 @@ server s1 { ...@@ -10,6 +10,8 @@ server s1 {
} -start } -start
varnish v1 -vcl+backend { varnish v1 -vcl+backend {
import std;
sub vcl_backend_response { sub vcl_backend_response {
if (bereq.url == "/333") { if (bereq.url == "/333") {
set beresp.status = 333; set beresp.status = 333;
...@@ -18,7 +20,7 @@ varnish v1 -vcl+backend { ...@@ -18,7 +20,7 @@ varnish v1 -vcl+backend {
} }
sub vcl_deliver { sub vcl_deliver {
if (req.url == "/332") { if (req.url == "/332") {
return (synth(332, "FOO")); return (synth(332, "F" + "OO" + std.tolower("FOO")));
} else if (req.url == "/333") { } else if (req.url == "/333") {
return (synth(resp.status + 1000, return (synth(resp.status + 1000,
resp.reason)); resp.reason));
...@@ -64,6 +66,7 @@ client c2 { ...@@ -64,6 +66,7 @@ client c2 {
txreq -url /332 txreq -url /332
rxresp rxresp
expect resp.status == 332 expect resp.status == 332
expect resp.reason == "FOOfoo"
expect resp.http.restarts == 1 expect resp.http.restarts == 1
expect resp.bodylen == 1 expect resp.bodylen == 1
} -run } -run
...@@ -920,6 +920,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, vcc_type_t fmt) ...@@ -920,6 +920,7 @@ vcc_expr_add(struct vcc *tl, struct expr **e, vcc_type_t fmt)
*e = vcc_expr_edit(tl, STRINGS, *e = vcc_expr_edit(tl, STRINGS,
"\v1\n\v2", *e, e2); "\v1\n\v2", *e, e2);
(*e)->constant = EXPR_CONST; (*e)->constant = EXPR_CONST;
(*e)->nstr = 1;
if (lit) if (lit)
(*e)->constant |= EXPR_STR_CONST; (*e)->constant |= EXPR_STR_CONST;
} else { } else {
...@@ -1297,6 +1298,8 @@ vcc_Expr(struct vcc *tl, vcc_type_t fmt) ...@@ -1297,6 +1298,8 @@ vcc_Expr(struct vcc *tl, vcc_type_t fmt)
assert(fmt != STRINGS); assert(fmt != STRINGS);
vcc_expr0(tl, &e, fmt); vcc_expr0(tl, &e, fmt);
ERRCHK(tl); ERRCHK(tl);
assert(e->fmt == fmt);
vcc_expr_fmt(tl->fb, tl->indent, e); vcc_expr_fmt(tl->fb, tl->indent, e);
VSB_printf(tl->fb, "\n"); VSB_printf(tl->fb, "\n");
vcc_delete_expr(e); vcc_delete_expr(e);
......
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