From: Helmut Grohne <helmut.grohne@intenta.de>
Subject: signal "Connection: close" when we we're going to close it

When connection_handle_response_end_state figures that it did not exhaustively
read the request body, it concludes that keep-alive is not possible. Reading
the request body would be unreasonable. This patch mirrors the check into
http_response_write_header right before emitting a "Connection" header. The
behaviour of disabling keep-alive is unchanged, but now we tell the remote side
that we are going to close the connection.

--- a/src/response.c
+++ b/src/response.c
@@ -36,6 +36,10 @@ int http_response_write_header(server *s
 	/* disable keep-alive if requested */
 	if (con->request_count > con->conf.max_keep_alive_requests || 0 == con->conf.max_keep_alive_idle) {
 		con->keep_alive = 0;
+	/* connection_handle_response_end_state will disable keep_alive later.
+	 * Disabling here already to send Connection: close to the client. */
+	} else if (con->request.content_length != con->request_content_queue->bytes_in) {
+		con->keep_alive = 0;
 	} else {
 		con->keep_alive_idle = con->conf.max_keep_alive_idle;
 	}
