Please sign in to comment.
Better Content-Length handling for HEAD requests
Responses to HEAD requests _should_ have a Content-Length header that's identical to GET requests. When a body is provided by the application, set the Content-Length header to the size of the body and replace the body with an empty Array; when no body is provided by the application in response to a HEAD request, and the Content-Length is calculated to be "0", remove the Content-Length header entirely to avoid mis-matched values. The idea here is that it's better to omit the header when we believe the Content-Length is not indicative of the same in response to GET than to send the Content-Length with a mismatched value. Logic taken from Apache and is generally in line with RFC 2616.
- Loading branch information...
Showing with 11 additions and 3 deletions.