dovecot-2.2: lib-http: http-client: Implemented explicit HTTP/1....

dovecot at dovecot.org dovecot at dovecot.org
Sun Sep 15 03:57:22 EEST 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/bcaee8677d7d
changeset: 16755:bcaee8677d7d
user:      Stephan Bosch <stephan at rename-it.nl>
date:      Sun Sep 15 03:56:47 2013 +0300
description:
lib-http: http-client: Implemented explicit HTTP/1.0 support.

diffstat:

 src/lib-http/http-client-request.c |  6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)

diffs (31 lines):

diff -r ccd39339596e -r bcaee8677d7d src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Sun Sep 15 03:56:25 2013 +0300
+++ b/src/lib-http/http-client-request.c	Sun Sep 15 03:56:47 2013 +0300
@@ -151,9 +151,9 @@
 				    const char *key, const char *value)
 {
 	i_assert(req->state == HTTP_REQUEST_STATE_NEW);
-	/* don't allow setting Date header directly;
+	/* don't allow setting Date or Connection header directly;
 	   this is ignored for now for backwards compatibility */
-	if (strcasecmp(key, "Date") == 0)
+	if (strcasecmp(key, "Date") == 0 || strcasecmp(key, "Connection") == 0)
 		return;
 	str_printfa(req->headers, "%s: %s\r\n", key, value);
 }
@@ -423,6 +423,7 @@
 		str_append(rtext, "Expect: 100-continue\r\n");
 	}
 	if (req->payload_chunked) {
+		// FIXME: can't do this for a HTTP/1.0 server
 		str_append(rtext, "Transfer-Encoding: chunked\r\n");
 		req->payload_output =
 			http_transfer_chunked_ostream_create(output);
@@ -434,6 +435,7 @@
 		req->payload_output = output;
 		o_stream_ref(output);
 	}
+	str_append(rtext, "Connection: Keep-Alive\r\n");
 
 	iov[0].iov_base = str_data(rtext);
 	iov[0].iov_len = str_len(rtext);


More information about the dovecot-cvs mailing list