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 17 years ago
parent 26b10e7fe8
commit 8f1558e1bb
  1. 8
      src/response.c

@ -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);

Loading…
Cancel
Save