Commit f0232502 authored by Nils Goroll's avatar Nils Goroll Committed by Dridi Boukelmoune

promote resp.body / beresp.body syntax a bit more

Should we plan to phase out synthetic() ?
parent 5cde1b15
......@@ -9,7 +9,7 @@ varnish v1 -vcl {
}
sub vcl_synth {
synthetic("Custom vcl_synth's synth output");
set resp.body = "Custom vcl_synth's body";
return (deliver);
}
} -start
......@@ -18,8 +18,9 @@ client c1 {
txreq -url "/"
rxresp
expect resp.status == 888
expect resp.bodylen == 31
expect resp.http.connection != close
expect resp.bodylen == 23
expect resp.body == "Custom vcl_synth's body"
} -run
varnish v1 -expect s_synth == 1
......@@ -8,7 +8,7 @@ varnish v1 -vcl {
set beresp.ttl = 1s;
set beresp.grace = 3s;
set beresp.http.foobar = "BLA" + bereq.xid;
synthetic(beresp.http.foobar);
set beresp.body = beresp.http.foobar;
return (deliver);
}
} -start
......@@ -24,9 +24,11 @@ client c1 {
txreq
rxresp
expect resp.http.foobar == "BLA1002"
expect resp.body == "BLA1002"
delay 3
txreq
rxresp
expect resp.http.foobar == "BLA1004"
expect resp.body == "BLA1004"
} -run
......@@ -37,7 +37,7 @@ varnish v1 -vcl+backend {
return (restart);
} else {
set resp.http.restarts = req.restarts;
synthetic(req.restarts);
set resp.body = req.restarts;
}
}
return (deliver);
......
......@@ -42,8 +42,8 @@ varnish v1 -vcl+backend {
}
sub vcl_synth {
synthetic("Response was served by "
+ std.fileread("${tmpdir}/m00004_file_four"));
set resp.body = "Response was served by "
+ std.fileread("${tmpdir}/m00004_file_four");
return(deliver);
}
} -start
......@@ -111,8 +111,8 @@ varnish v1 -vcl+backend {
}
sub vcl_synth {
synthetic("Response was served by "
+ std.fileread("${tmpdir}/m00004_file_four"));
set resp.body = "Response was served by "
+ std.fileread("${tmpdir}/m00004_file_four");
return(deliver);
}
}
......
......@@ -18,7 +18,8 @@ varnish v1 -vcl+backend {
sub vcl_synth {
if (resp.status == 998) {
synthetic("this is the body of an included synthetic response");
set resp.body = "this is the body of an " +
"included synthetic response";
return(deliver);
}
}
......
......@@ -14,7 +14,7 @@ varnish v1 -vcl+backend {
sub vcl_synth {
if (resp.status == 998) {
synthetic("synthetic body");
set resp.body = "synthetic body";
return (deliver);
}
}
......
......@@ -6,7 +6,7 @@ server s1 {
varnish v1 -arg "-s Transient=file,${tmpdir}/_.file,10m" -vcl+backend {
sub vcl_backend_error {
synthetic("foo");
set beresp.body = "foo";
return (deliver);
}
} -start
......
......@@ -467,8 +467,10 @@ hash_data(input)
synthetic(STRING)
~~~~~~~~~~~~~~~~~
Prepare a synthetic response body containing the *STRING*. Available in
``vcl_synth`` and ``vcl_backend_error``.
Prepare a synthetic response body containing the *STRING*. Available
in ``vcl_synth`` and ``vcl_backend_error``.
Identical to ``set resp.body`` / ``set beresp.body``.
.. list above comes from struct action_table[] in vcc_action.c.
......
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