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
e0c8a524
Unverified
Commit
e0c8a524
authored
Jun 20, 2022
by
Nils Goroll
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for ESI subrequests vs. Request body
Make sure subrequests to not see Content-Length / Transfer-Encoding
parent
2feafdcf
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
83 additions
and
0 deletions
+83
-0
e00036.vtc
bin/varnishtest/tests/e00036.vtc
+83
-0
No files found.
bin/varnishtest/tests/e00036.vtc
0 → 100644
View file @
e0c8a524
varnishtest "ESI vs. request body"
server s1 {
rxreq
expect req.method == POST
expect req.url == "/foo/bar"
expect req.bodylen == 6
expect req.http.Content-Length == "6"
expect req.http.Transfer-Encoding == "
<undef>
"
txresp -body {
<html>
Before include
<!--esi <esi:include src="body1"/> -->
After include
}
rxreq
expect req.method == XGET
expect req.url == "/foo/body1"
expect req.bodylen == 0
expect req.http.Content-Length == "
<undef>
"
expect req.http.Transfer-Encoding == "
<undef>
"
txresp -body {
Included file
}
rxreq
expect req.method == POST
expect req.url == "/foo/bar"
expect req.bodylen == 66
# std.cache_req_body() turns chunked into C-L
expect req.http.Content-Length == "66"
expect req.http.Transfer-Encoding == "
<undef>
"
txresp -body {
<html>
Before include
<!--esi <esi:include src="body2"/> -->
After include
}
rxreq
expect req.method == XGET
expect req.url == "/foo/body2"
expect req.bodylen == 0
expect req.http.Content-Length == "
<undef>
"
expect req.http.Transfer-Encoding == "
<undef>
"
txresp -body {
Included file
}
} -start
varnish v1 -vcl+backend {
import std;
sub vcl_recv {
std.cache_req_body(1KB);
if (req.url ~ "^/foo/body") {
set req.method = "XGET";
}
return (pass);
}
sub vcl_backend_response {
if (bereq.url !~ "^/foo/body") {
set beresp.do_esi = true;
}
}
} -start
client c1 {
txreq -url /foo/bar -method POST -body {foobar}
rxresp
expect resp.status == 200
expect resp.bodylen == 67
txreq -url /foo/bar -method POST -nolen \
-hdr "Transfer-encoding: chunked"
chunkedlen 66
chunkedlen 0
rxresp
expect resp.status == 200
expect resp.bodylen == 67
} -run
varnish v1 -expect esi_errors == 0
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