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
586bfa49
Unverified
Commit
586bfa49
authored
Apr 04, 2020
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add obj.can_esi
Ref #3002
parent
9fa55a59
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
42 additions
and
2 deletions
+42
-2
cache_vrt_var.c
bin/varnishd/cache/cache_vrt_var.c
+11
-0
e00000.vtc
bin/varnishtest/tests/e00000.vtc
+4
-0
e00001.vtc
bin/varnishtest/tests/e00001.vtc
+4
-0
e00003.vtc
bin/varnishtest/tests/e00003.vtc
+7
-2
e00032.vtc
bin/varnishtest/tests/e00032.vtc
+4
-0
vcl_var.rst
doc/sphinx/reference/vcl_var.rst
+12
-0
No files found.
bin/varnishd/cache/cache_vrt_var.c
View file @
586bfa49
...
...
@@ -442,6 +442,17 @@ VRT_r_obj_storage(VRT_CTX)
/*--------------------------------------------------------------------*/
VCL_BOOL
VRT_r_obj_can_esi
(
VRT_CTX
)
{
CHECK_OBJ_NOTNULL
(
ctx
,
VRT_CTX_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
,
REQ_MAGIC
);
CHECK_OBJ_NOTNULL
(
ctx
->
req
->
objcore
,
OBJCORE_MAGIC
);
return
(
ObjHasAttr
(
ctx
->
req
->
wrk
,
ctx
->
req
->
objcore
,
OA_ESIDATA
));
}
/*--------------------------------------------------------------------*/
#define REQ_VAR_L(nm, elem, type, extra) \
\
VCL_VOID \
...
...
bin/varnishtest/tests/e00000.vtc
View file @
586bfa49
...
...
@@ -12,6 +12,9 @@ varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
}
sub vcl_deliver {
set resp.http.can_esi = obj.can_esi;
}
} -start
logexpect l1 -v v1 -g raw {
...
...
@@ -23,6 +26,7 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.bodylen == 33
expect resp.http.can_esi == "false"
}
client c1 -run
...
...
bin/varnishtest/tests/e00001.vtc
View file @
586bfa49
...
...
@@ -17,6 +17,9 @@ varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
}
sub vcl_deliver {
set resp.http.can_esi = obj.can_esi;
}
} -start
logexpect l1 -v v1 -g raw {
...
...
@@ -29,6 +32,7 @@ client c1 {
rxresp
expect resp.status == 200
expect resp.bodylen == 40
expect resp.http.can_esi == "true"
}
client c1 -run
...
...
bin/varnishtest/tests/e00003.vtc
View file @
586bfa49
...
...
@@ -32,12 +32,15 @@ varnish v1 -vcl+backend {
set beresp.do_esi = true;
}
}
sub vcl_deliver {
set resp.http.can_esi = obj.can_esi;
}
} -start
logexpect l1 -v v1 -g request {
expect 0 1001 Begin "^req .* rxreq"
# ReqAcct body counts include chunked overhead
expect * = ReqAcct "^29 0 29
187 104 291
$"
expect * = ReqAcct "^29 0 29
202 104 306
$"
expect 0 = End
} -start
...
...
@@ -61,7 +64,7 @@ logexpect l5 -v v1 -g request {
expect * 1005 Begin "^req .* rxreq"
# ReqAcct body counts include chunked overhead
# Header bytes is 5 larger than in l1 due to two item X-Varnish hdr
expect * = ReqAcct "^29 0 29
192 104 296
$"
expect * = ReqAcct "^29 0 29
207 104 311
$"
expect 0 = End
} -start
...
...
@@ -70,6 +73,7 @@ client c1 {
rxresp
expect resp.bodylen == 75
expect resp.status == 200
expect resp.http.can_esi == "true"
delay .1
# test that there is no difference on miss/hit
...
...
@@ -77,6 +81,7 @@ client c1 {
rxresp
expect resp.bodylen == 75
expect resp.status == 200
expect resp.http.can_esi == "true"
}
client c1 -run
...
...
bin/varnishtest/tests/e00032.vtc
View file @
586bfa49
...
...
@@ -14,12 +14,16 @@ varnish v1 -vcl+backend {
sub vcl_backend_response {
set beresp.do_esi = true;
}
sub vcl_deliver {
set resp.http.can_esi = obj.can_esi;
}
} -start
client c1 {
txreq -hdr "Accept-Encoding: gzip"
rxresp
expect resp.status == 200
expect resp.http.can_esi == "true"
gunzip
expect resp.bodylen == 3
} -run
doc/sphinx/reference/vcl_var.rst
View file @
586bfa49
...
...
@@ -1107,6 +1107,18 @@ obj.storage
The storage backend where this object is stored.
obj.can_esi
Type: BOOL
Readable from: vcl_hit, vcl_deliver
If the object can be ESI processed, that is if setting
``resp.do_esi`` or adding ``esi`` to ``resp.filters`` in
``vcl_deliver {}`` would cause the response body to be ESI
processed.
resp
~~~~
...
...
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