diff --git a/NEWS b/NEWS index dc2a0400..28260bb1 100644 --- a/NEWS +++ b/NEWS @@ -16,6 +16,7 @@ NEWS * Trust pcre-config, do not check for pcre manually (#1769) * Fix fastcgi authorization in subdirectories with check-local=disabled; don't split pathinfo for authorizer. (#963) * Add possibility to disable methods in mod_compress (#1773) + * Fix duplicate connection keep-alive/transfer-encoding headers (#960) - 1.4.20 - 2008-09-30 diff --git a/src/response.c b/src/response.c index 507c81c6..f28cf516 100644 --- a/src/response.c +++ b/src/response.c @@ -44,16 +44,15 @@ int http_response_write_header(server *srv, connection *con) { buffer_append_string(b, get_http_status_name(con->http_status)); if (con->request.http_version != HTTP_VERSION_1_1 || con->keep_alive == 0) { - buffer_append_string_len(b, CONST_STR_LEN("\r\nConnection: ")); if (con->keep_alive) { - buffer_append_string_len(b, CONST_STR_LEN("keep-alive")); + response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("keep-alive")); } else { - buffer_append_string_len(b, CONST_STR_LEN("close")); + response_header_overwrite(srv, con, CONST_STR_LEN("Connection"), CONST_STR_LEN("close")); } } if (con->response.transfer_encoding & HTTP_TRANSFER_ENCODING_CHUNKED) { - buffer_append_string_len(b, CONST_STR_LEN("\r\nTransfer-Encoding: chunked")); + response_header_overwrite(srv, con, CONST_STR_LEN("Transfer-Encoding"), CONST_STR_LEN("chunked")); }