miyagawa/Starman — pull request #87 by therigu (2013-09-14 18:15:39+00:00)
Title: Do not send a chunked body for HEAD requests

The HTTP 1.1 spec states

The HEAD method is identical to GET except that the server MUST NOT return a message-body in the response

If a Plack app does not set a body or a Content-Length for a response to a HEAD request (which I believe is correct), Starman currently enables chunked encoding and sends the chunked 'footer' in the body of the response. I believe this contradicts the spec (as above) and causes problems with my (nodejs) client.

Server.pm already disables chunked responses for status codes without a body (204 and 304) - this patch does the same for HEAD requests.

The test fails without the patch to the .pm, it has to use the low level IO::Socket::INET so we get the body before the chunked decoding is applied