Content-Length only works if Transfer-Encoding is not set

git-svn-id: svn://svn.lighttpd.net/lighttpd/branches/lighttpd-1.3.x@487 152afb58-edef-0310-8abb-c4023f1b3aa9
svn/heads/lighttpd-1.3.x
Jan Kneschke 2005-07-31 10:15:15 +00:00
parent 26b10e7fe8
commit 8f1558e1bb
1 changed files with 3 additions and 5 deletions

View File

@ -151,6 +151,9 @@ int http_response_write_header(server *srv, connection *con,
if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) {
BUFFER_APPEND_STRING_CONST(b, "\r\nTransfer-Encoding: chunked");
} else if (file_size >= 0 && con->http_status != 304) {
BUFFER_APPEND_STRING_CONST(b, "\r\nContent-Length: ");
buffer_append_off_t(b, file_size);
}
/* HTTP/1.1 requires a Date: header */
@ -208,11 +211,6 @@ int http_response_write_header(server *srv, connection *con,
buffer_append_string_buffer(b, srv->mtime_cache[i].str);
}
if (file_size >= 0 && con->http_status != 304) {
BUFFER_APPEND_STRING_CONST(b, "\r\nContent-Length: ");
buffer_append_off_t(b, file_size);
}
if (con->physical.path->used && con->physical.etag->used) {
BUFFER_APPEND_STRING_CONST(b, "\r\nETag: ");
buffer_append_string_buffer(b, con->physical.etag);