Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
varnish-cache
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
varnishcache
varnish-cache
Commits
d2f603c5
Commit
d2f603c5
authored
Mar 01, 2024
by
Dridi Boukelmoune
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
esi: Skip the response body for onerror="continue"
That is to say, when we can actually do that.
parent
c5b7a014
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
32 additions
and
6 deletions
+32
-6
cache_esi_deliver.c
bin/varnishd/cache/cache_esi_deliver.c
+3
-2
e00035.vtc
bin/varnishtest/tests/e00035.vtc
+24
-2
r03865.vtc
bin/varnishtest/tests/r03865.vtc
+1
-1
esi.rst
doc/sphinx/users-guide/esi.rst
+4
-1
No files found.
bin/varnishd/cache/cache_esi_deliver.c
View file @
d2f603c5
...
...
@@ -881,8 +881,9 @@ ved_deliver(struct req *req, struct boc *boc, int wantbody)
status
=
req
->
resp
->
status
%
1000
;
if
(
ecx
->
abrt
&&
status
!=
200
&&
status
!=
204
)
{
ved_close
(
req
,
boc
,
1
);
if
(
FEATURE
(
FEATURE_ESI_INCLUDE_ONERROR
)
&&
status
!=
200
&&
status
!=
204
)
{
ved_close
(
req
,
boc
,
ecx
->
abrt
);
return
;
}
...
...
bin/varnishtest/tests/e00035.vtc
View file @
d2f603c5
...
...
@@ -8,7 +8,7 @@ server s1 {
rxreq
expect req.url == "/fail"
txresp -hdr "content-length: 100"
-nolen
txresp -hdr "content-length: 100"
delay 0.1
} -start
...
...
@@ -17,6 +17,7 @@ varnish v1 -cliok "param.set feature +esi_include_onerror"
varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = beresp.http.surrogate-control ~ "ESI/1.0";
set beresp.do_stream = beresp.http.stream != "false";
unset beresp.http.surrogate-control;
}
} -start
...
...
@@ -38,7 +39,7 @@ server s1 {
rxreq
expect req.url == "/fail"
txresp -hdr "content-length: 100"
-nolen
txresp -hdr "content-length: 100"
delay 0.1
} -start
...
...
@@ -48,3 +49,24 @@ client c1 {
rxresp
expect resp.body == "before after"
} -run
server s1 -wait
server s1 {
rxreq
expect req.url == "/continue-no-stream"
txresp -hdr {surrogate-control: content="ESI/1.0"} \
-body {before <esi:include src="/err" onerror="continue"/> after}
rxreq
expect req.url == "/err"
txresp -hdr "content-encoding chunked" -hdr "stream: false"
chunked "incomplete"
} -start
client c1 {
fatal
txreq -url "/continue-no-stream"
rxresp
expect resp.body == "before after"
} -run
bin/varnishtest/tests/r03865.vtc
View file @
d2f603c5
...
...
@@ -93,7 +93,7 @@ client c1 {
fatal
txreq -url "/continue"
rxresp
expect resp.body == "before
FOOBAR
after"
expect resp.body == "before after"
} -run
varnish v1 -cliok "param.set max_esi_depth 0"
...
...
doc/sphinx/users-guide/esi.rst
View file @
d2f603c5
...
...
@@ -128,7 +128,10 @@ continue in case of failures, by setting::
param.set feature +esi_include_onerror
Once this feature flag is enabled, a delivery failure can only continue
if an ``onerror`` attribute said so.
if an ``onerror`` attribute said so. The ESI specification states that
in that case the failing fragment is not delivered, which is honored based
on the status code, or based on the response body only when streaming is
disabled (see ``beresp.do_stream``).
Can an ESI fragment also use ESI-includes ?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment