From 7a220fceb4f6bb66dc158e0f15c075d1a7e1d0c4 Mon Sep 17 00:00:00 2001 From: Jan Kneschke Date: Sat, 7 Oct 2006 17:17:54 +0000 Subject: [PATCH] don't force a Content-Length header in HEAD requests (#119) git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.4.x@1382 152afb58-edef-0310-8abb-c4023f1b3aa9 --- src/connections.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/connections.c b/src/connections.c index 445e00a6..5b2b7be1 100644 --- a/src/connections.c +++ b/src/connections.c @@ -522,7 +522,8 @@ static int connection_handle_write_prepare(server *srv, connection *con) { /* we have all the content and chunked encoding is not used, set a content-length */ if ((!(con->parsed_response & HTTP_CONTENT_LENGTH)) && - (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) == 0) { + (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) == 0 && + con->request.http_method != HTTP_METHOD_HEAD) { /* don't force a Content-Length if we had a HEAD request */ buffer_copy_off_t(srv->tmp_buf, chunkqueue_length(con->write_queue)); response_header_overwrite(srv, con, CONST_STR_LEN("Content-Length"), CONST_BUF_LEN(srv->tmp_buf));