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
2ac6b4de
Commit
2ac6b4de
authored
Aug 17, 2018
by
Guillaume Quintard
Committed by
Dridi Boukelmoune
Oct 16, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Don't mess with C-L when responding to HEAD
parent
17735572
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
4 deletions
+25
-4
cache_req_fsm.c
bin/varnishd/cache/cache_req_fsm.c
+5
-4
b00065.vtc
bin/varnishtest/tests/b00065.vtc
+20
-0
No files found.
bin/varnishd/cache/cache_req_fsm.c
View file @
2ac6b4de
...
...
@@ -342,7 +342,7 @@ cnt_transmit(struct worker *wrk, struct req *req)
struct
boc
*
boc
;
const
char
*
r
;
uint16_t
status
;
int
err
,
sendbody
;
int
err
,
sendbody
,
head
;
intmax_t
clval
;
CHECK_OBJ_NOTNULL
(
wrk
,
WORKER_MAGIC
);
...
...
@@ -364,7 +364,8 @@ cnt_transmit(struct worker *wrk, struct req *req)
/* RFC 7230, 3.3.3 */
status
=
http_GetStatus
(
req
->
resp
);
if
(
!
strcmp
(
req
->
http0
->
hd
[
HTTP_HDR_METHOD
].
b
,
"HEAD"
))
{
head
=
!
strcmp
(
req
->
http0
->
hd
[
HTTP_HDR_METHOD
].
b
,
"HEAD"
);
if
(
head
)
{
if
(
req
->
objcore
->
flags
&
OC_F_PASS
)
sendbody
=
-
1
;
else
...
...
@@ -396,8 +397,8 @@ cnt_transmit(struct worker *wrk, struct req *req)
}
}
if
(
sendbody
<
0
)
{
/* Don't touch
pass+
HEAD C-L */
if
(
sendbody
<
0
||
head
)
{
/* Don't touch HEAD C-L */
sendbody
=
0
;
}
else
if
(
clval
>=
0
&&
clval
==
req
->
resp_len
)
{
/* Reuse C-L header */
...
...
bin/varnishtest/tests/b00065.vtc
0 → 100644
View file @
2ac6b4de
varnishtest "Test that C-L on HEAD request aren't nuked"
server s1 {
rxreq
txresp -nolen -hdr "content-length: 17"
expect req.method == "HEAD"
} -start
varnish v1 -vcl+backend {
sub vcl_backend_fetch {
set bereq.method = "HEAD";
}
} -start
client c1 {
txreq -req HEAD -hdr "connection: close"
rxresphdrs
expect resp.http.content-length == 17
expect_close
} -run
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