Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
L
libvmod-esiextra
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
uplex-varnish
libvmod-esiextra
Commits
a99ce697
Commit
a99ce697
authored
Nov 23, 2017
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update to explicit std.fetch_body(deliver)
parent
5301a92e
Pipeline
#401
skipped
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
24 additions
and
4 deletions
+24
-4
vfp_bodyhash.c
src/vfp_bodyhash.c
+1
-1
vmod_esiextra.vcc
src/vmod_esiextra.vcc
+2
-2
esi_recursive_full.vtc
src/vtc/esi_recursive_full.vtc
+19
-1
vmod_esiextra.vtc
src/vtc/vmod_esiextra.vtc
+2
-0
No files found.
src/vfp_bodyhash.c
View file @
a99ce697
...
...
@@ -132,7 +132,7 @@ vfp_bodyhash_fini(struct vfp_ctx *vc, struct vfp_entry *vfe)
*
p
++
=
'\0'
;
assert
(
pdiff
(
hex
,
p
)
==
hexl
);
if
(
vc
->
resp
&&
vc
->
resp
->
thd
)
{
if
(
vc
->
resp
)
{
http_ForceHeader
(
vc
->
resp
,
H_ETag
,
hex
);
goto
out
;
}
...
...
src/vmod_esiextra.vcc
View file @
a99ce697
...
...
@@ -18,9 +18,9 @@ capabilities like:
* generate ``ETag`` backend response headers
* track the most recent ``Last-Modified`` date of all ESI includes.
It requires chunked encoding trailer support, which, as of 2017-11-
06
,
It requires chunked encoding trailer support, which, as of 2017-11-
23
,
has not been merged to varnish-cache. See
https://github.com/
varnishcache/varnish-cache/pull/2477
https://github.com/
nigoroll/varnish-cache/pull/6
Example
::
...
...
src/vtc/esi_recursive_full.vtc
View file @
a99ce697
...
...
@@ -39,9 +39,15 @@ server s1 {
txresp \
-hdr "Last-Modified: Fri, 03 Nov 2017 18:38:04 GMT" \
-body {
<html></html>
}
rxreq
expect req.url == "/nobody"
txresp -status 302 -body {}
} -start
varnish v1 -arg "-p feature=+esi_disable_xml_check" -vcl+backend {} -start
varnish v1 -arg "-p feature=+esi_disable_xml_check" \
-arg "-p debug=+syncvsl" \
-vcl+backend {} -start
varnish v1 -vcl+backend {
import esiextra;
...
...
@@ -175,6 +181,7 @@ varnish v1 -vcl+backend {
} else {
set beresp.http.Trailer = "ETag";
}
std.fetch_body(deliver);
return (deliver);
}
set beresp.http.Vary = "X-TE";
...
...
@@ -239,6 +246,17 @@ client c1 {
expect resp.http.Last-Modified == "Fri, 03 Nov 2017 18:38:04 GMT"
expect resp.http.ETag == {"b633a587c652d02386c4f16f8c6f6aab7352d97f16367c3c40576214372dd628"}
expect resp.http.hits == "0,0"
# response with no body
txreq -url "/nobody"
rxresp
expect resp.status == 302
expect resp.bodylen == 0
expect resp.http.Trailer ==
<undef>
expect resp.http.X-ESI == "/nobody"
expect resp.http.Last-Modified ==
<undef>
expect resp.http.ETag == {"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855"}
expect resp.http.hits == "0,0"
} -run
varnish v1 -expect esi_errors == 0
logexpect l1 -wait
src/vtc/vmod_esiextra.vtc
View file @
a99ce697
...
...
@@ -24,10 +24,12 @@ server s1 {
varnish v1 -vcl+backend {
import std;
import esiextra;
sub vcl_backend_response {
esiextra.bodyhash(beresp.http.ETag);
std.fetch_body(deliver);
}
} -start
...
...
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