Commit f07287a6 authored by Brandon Black's avatar Brandon Black Committed by Pål Hermunn Johansen

Correctly handle HTTP/1.1 EOF response

Commit e142a199 for Issue #1918 fixed up the case where the
server sends an HTTP/1.1 response with no Content-Length, no
Transfer-Encoding, but with Connection:close.

This fixes the very similar case where all the conditions are the
same except that there's also no Connection: close header, but the
content is still implicitly delimited by the server closing the
connection.

This behavior has been observed from multiple versions of Apache
with WSGI applications behind it, resulting in broken
Content-Length:0 responses from Varnish.

Ref: varnishcache/varnish-cache#1954
parent 55a08f55
......@@ -307,7 +307,7 @@ http1_body_status(const struct http *hp, struct http_conn *htc, int request)
return (cl == 0 ? BS_NONE : BS_LENGTH);
}
if (hp->protover == 11 && (request || !http_HdrIs(hp, H_Connection, "close")))
if (hp->protover == 11 && request)
return (BS_NONE);
if (http_HdrIs(hp, H_Connection, "keep-alive")) {
......
......@@ -3,19 +3,15 @@ varnishtest "Check EOF responses work with HTTP/1.1"
server s1 {
rxreq
txresp -nolen -bodylen 10
rxreq
txresp -hdr "Connection: close" -nolen -bodylen 10
close
accept
} -start
varnish v1 -vcl+backend {
} -start
client c1 {
txreq -url /1
rxresp
expect resp.status == 200
expect resp.bodylen == 0
txreq -url /2
txreq
rxresp
expect resp.status == 200
expect resp.bodylen == 10
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment