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
a61cf0d1
Commit
a61cf0d1
authored
Mar 02, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
NUL terminate the ungzip'ed body so we can expect on it.
Fixes #1688
parent
6bd3d3ba
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
47 additions
and
0 deletions
+47
-0
r01688.vtc
bin/varnishtest/tests/r01688.vtc
+45
-0
vtc_http.c
bin/varnishtest/vtc_http.c
+2
-0
No files found.
bin/varnishtest/tests/r01688.vtc
0 → 100644
View file @
a61cf0d1
varnishtest "ESI-included, compressed synthetic responses"
server s1 {
rxreq
expect req.url == "/bar"
txresp -gzipbody {<XYZ><esi:include src="/foo"/></XYZ>}
rxreq
expect req.url == "/baz"
txresp -gzipbody {<XYZ><esi:include src="/quux"/></XYZ>}
} -start
varnish v1 -vcl+backend {
sub vcl_recv {
if (req.url == "/foo" || req.url == "/quux") {
return(synth(998, "included synthetic reponse"));
}
}
sub vcl_synth {
if (resp.status == 998) {
synthetic("this is the body of an included synthetic response");
return(deliver);
}
}
sub vcl_backend_response {
set beresp.do_esi = true;
}
} -start
client c1 {
txreq -url /bar
rxresp
expect resp.status == 200
delay .1
expect resp.body == "<XYZ>this is the body of an included synthetic response</XYZ>"
txreq -url /baz -hdr "Accept-Encoding: gzip"
timeout 2
rxresp
expect resp.status == 200
expect resp.http.Content-Encoding == "gzip"
gunzip
expect resp.body == "<XYZ>this is the body of an included synthetic response</XYZ>"
} -run
bin/varnishtest/vtc_http.c
View file @
a61cf0d1
...
...
@@ -633,6 +633,7 @@ cmd_http_gunzip_body(CMD_ARGS)
assert
(
Z_OK
==
inflateInit2
(
&
vz
,
31
));
i
=
inflate
(
&
vz
,
Z_FINISH
);
assert
(
vz
.
total_out
<
l
);
hp
->
bodyl
=
vz
.
total_out
;
memcpy
(
hp
->
body
,
p
,
hp
->
bodyl
);
free
(
p
);
...
...
@@ -653,6 +654,7 @@ cmd_http_gunzip_body(CMD_ARGS)
"Gunzip error = %d (%s) in:%jd out:%jd"
,
i
,
vz
.
msg
,
(
intmax_t
)
vz
.
total_in
,
(
intmax_t
)
vz
.
total_out
);
assert
(
Z_OK
==
inflateEnd
(
&
vz
));
hp
->
body
[
hp
->
bodyl
]
=
'\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