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
a6a6e97a
Commit
a6a6e97a
authored
Sep 10, 2015
by
Poul-Henning Kamp
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Align code with RFC7230 section 3.3.3 which allows POST without a body.
Fixes: #1783
parent
2367d528
Changes
12
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
53 additions
and
65 deletions
+53
-65
cache_http1_proto.c
bin/varnishd/http1/cache_http1_proto.c
+14
-21
b00011.vtc
bin/varnishtest/tests/b00011.vtc
+1
-1
b00020.vtc
bin/varnishtest/tests/b00020.vtc
+1
-1
b00021.vtc
bin/varnishtest/tests/b00021.vtc
+2
-2
b00022.vtc
bin/varnishtest/tests/b00022.vtc
+2
-2
c00013.vtc
bin/varnishtest/tests/c00013.vtc
+1
-1
e00007.vtc
bin/varnishtest/tests/e00007.vtc
+1
-1
e00014.vtc
bin/varnishtest/tests/e00014.vtc
+1
-1
g00002.vtc
bin/varnishtest/tests/g00002.vtc
+1
-1
r00733.vtc
bin/varnishtest/tests/r00733.vtc
+1
-1
r01729.vtc
bin/varnishtest/tests/r01729.vtc
+9
-33
r01783.vtc
bin/varnishtest/tests/r01783.vtc
+19
-0
No files found.
bin/varnishd/http1/cache_http1_proto.c
View file @
a6a6e97a
...
...
@@ -282,15 +282,19 @@ http1_body_status(struct http *hp, struct http_conn *htc)
htc
->
content_length
=
-
1
;
if
(
http_HdrIs
(
hp
,
H_Transfer_Encoding
,
"chunked"
))
{
http_Unset
(
hp
,
H_Content_Length
);
cl
=
http_GetContentLength
(
hp
);
if
(
http_GetHdr
(
hp
,
H_Transfer_Encoding
,
&
b
))
{
if
(
strcasecmp
(
b
,
"chunked"
))
return
(
BS_ERROR
);
if
(
cl
!=
-
1
)
{
/*
* RFC7230 3.3.3 allows more lenient handling
* but we're going to be strict.
*/
return
(
BS_ERROR
);
}
return
(
BS_CHUNKED
);
}
if
(
http_GetHdr
(
hp
,
H_Transfer_Encoding
,
&
b
))
return
(
BS_ERROR
);
cl
=
http_GetContentLength
(
hp
);
if
(
cl
==
-
2
)
return
(
BS_ERROR
);
if
(
cl
>=
0
)
{
...
...
@@ -298,6 +302,9 @@ http1_body_status(struct http *hp, struct http_conn *htc)
return
(
cl
==
0
?
BS_NONE
:
BS_LENGTH
);
}
if
(
hp
->
protover
==
11
)
return
(
BS_NONE
);
if
(
http_HdrIs
(
hp
,
H_Connection
,
"keep-alive"
))
{
/*
* Keep alive with neither TE=Chunked or C-Len is impossible.
...
...
@@ -306,20 +313,6 @@ http1_body_status(struct http *hp, struct http_conn *htc)
return
(
BS_NONE
);
}
if
(
http_HdrIs
(
hp
,
H_Connection
,
"close"
))
{
/*
* In this case, it is safe to just read what comes.
*/
return
(
BS_EOF
);
}
if
(
hp
->
protover
<
11
)
{
/*
* With no Connection header, assume EOF.
*/
return
(
BS_EOF
);
}
/*
* Fall back to EOF transfer.
*/
...
...
bin/varnishtest/tests/b00011.vtc
View file @
a6a6e97a
...
...
@@ -2,7 +2,7 @@ varnishtest "Check HTTP/1.0 EOF transmission"
server s1 {
rxreq
send "HTTP/1.
1
200 OK\n"
send "HTTP/1.
0
200 OK\n"
send "Connection: close\n"
send "\n"
send "Body line 1\n"
...
...
bin/varnishtest/tests/b00020.vtc
View file @
a6a6e97a
...
...
@@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS
server s1 {
rxreq
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay 1.5
# send "Baba\n"
} -start
...
...
bin/varnishtest/tests/b00021.vtc
View file @
a6a6e97a
...
...
@@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS
server s1 {
rxreq
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay 4.0
send "Baba\n"
} -start
...
...
@@ -26,7 +26,7 @@ client c1 {
server s1 {
rxreq
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay 1.0
send "Baba\n"
delay 1.0
...
...
bin/varnishtest/tests/b00022.vtc
View file @
a6a6e97a
...
...
@@ -4,7 +4,7 @@ feature SO_RCVTIMEO_WORKS
server s1 {
rxreq
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay 1.5
send "Baba\n"
} -start
...
...
@@ -28,7 +28,7 @@ client c1 {
server s1 {
rxreq
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay 0.5
send "Baba\n"
delay 0.5
...
...
bin/varnishtest/tests/c00013.vtc
View file @
a6a6e97a
...
...
@@ -3,7 +3,7 @@ varnishtest "Test parking second request on backend delay"
server s1 {
rxreq
expect req.url == "/foo"
send "HTTP/1.
1
200 OK\r\nConnection: close\r\n\r\n"
send "HTTP/1.
0
200 OK\r\nConnection: close\r\n\r\n"
delay .2
sema r1 sync 2
delay .2
...
...
bin/varnishtest/tests/e00007.vtc
View file @
a6a6e97a
...
...
@@ -16,7 +16,7 @@ varnishtest "ESI spanning storage bits"
server s1 {
rxreq
expect req.url == "/foo/bar"
send "HTTP/1.
1
200 OK\n"
send "HTTP/1.
0
200 OK\n"
send "Connection: close\n"
send "\n"
send {
...
...
bin/varnishtest/tests/e00014.vtc
View file @
a6a6e97a
...
...
@@ -3,7 +3,7 @@ varnishtest "Check <esi: detector"
server s1 {
rxreq
expect req.url == "/foo"
send "HTTP/1.
1
200 OK\n"
send "HTTP/1.
0
200 OK\n"
send "Connection: close\n"
send "\n"
send { <a> <esi/> }
...
...
bin/varnishtest/tests/g00002.vtc
View file @
a6a6e97a
...
...
@@ -4,7 +4,7 @@ server s1 {
rxreq
expect req.http.accept-encoding == "gzip"
expect req.url == "/foo"
txresp -nolen -gziplen 4100
txresp -
proto HTTP/1.0 -
nolen -gziplen 4100
accept
rxreq
expect req.url == "/bar"
...
...
bin/varnishtest/tests/r00733.vtc
View file @
a6a6e97a
...
...
@@ -2,7 +2,7 @@ varnishtest "HTTP/1.1 Backend sends no length hint"
server s1 {
rxreq
send "HTTP/1.
1
200 OK\n"
send "HTTP/1.
0
200 OK\n"
send "\n"
send "12345"
} -start
...
...
bin/varnishtest/tests/r01729.vtc
View file @
a6a6e97a
varnishtest "C-L/T-E:chunked conflict"
server s1 {
rxreqhdrs
expect req.http.content-length == <undef>
expect req.http.transfer-encoding == chunked
rxreqbody
expect req.url == /1
rxreq
expect req.bodylen == 20
send "HTTP/1.1 200 OK"
send "Content-Length: 31\r\n"
send "Transfer-Encoding: chunked\r\n"
send "\r\n"
send "14\r\n"
send "0123456789"
send "0123456789"
send "0\r\n"
send "\r\n"
rxreqhdrs
expect req.http.content-length == 20
expect req.http.transfer-encoding == <undef>
expect req.url == /2
expect req.bodylen == 20
send "HTTP/1.1 200 OK"
send "HTTP/1.1 200 OK\r\n"
send "Content-Length: 31\r\n"
send "Transfer-Encoding: chunked\r\n"
send "\r\n"
...
...
@@ -36,14 +16,7 @@ server s1 {
} -start
varnish v1 -vcl+backend {
import ${vmod_std};
sub vcl_recv {
if (req.url == "/2") {
std.cache_req_body(1KB);
}
}
} -start
varnish v1 -vcl+backend { } -start
client c1 {
...
...
@@ -56,12 +29,14 @@ client c1 {
send "0123456789"
send "0\r\n"
send "\r\n"
rxresp
expect resp.bodylen == 20
expect resp.status == 400
} -run
client c1 {
send "PUT /2 HTTP/1.1\r\n"
send "Content-Length: 31\r\n"
send "Transfer-Encoding: chunked\r\n"
send "\r\n"
send "14\r\n"
...
...
@@ -69,7 +44,8 @@ client c1 {
send "0123456789"
send "0\r\n"
send "\r\n"
rxresp
expect resp.
bodylen == 20
expect resp.
status == 503
} -run
bin/varnishtest/tests/r01783.vtc
0 → 100644
View file @
a6a6e97a
varnishtest "POST with no body"
server s1 {
rxreq
txresp -hdr "foo: 1"
rxreq
txresp -hdr "foo: 2"
} -start
varnish v1 -vcl+backend {} -start
client c1 {
txreq -req "POST" -nolen
rxresp
expect resp.http.foo == 1
txreq -req "POST" -nolen
rxresp
expect resp.http.foo == 2
} -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