A zero-length chunk has a protocol-significant meaning: it signals the
end of the response. An empty part in a Rack body has no such meaning,
so we should just skip it.
Some HTTP verbs imply that no body is sent with
the response. Puma did not respect that.
This led to issues like this one:
$ curl localhost:9292
curl: (18) transfer closed with outstanding
read data remaining
This also breaks persistent connections.
Example program to program to provoke this issue:
proc do
[204, {'Conten-Type' => 'text/plain'}, []]
end
Signed-off-by: Konstantin Haase <konstantin.mailinglists@googlemail.com>
Seems that an HTTP/1.0 client needs to be told that the connection is
still in keep alive mode by setting the Connection header to Keep-Alive.
This makes sense because a server could deny the request and thus no
Connection header means close mode.