dovecot-2.2: lib-http: http-server now always creates a payload ...

dovecot at dovecot.org dovecot at dovecot.org
Sun May 10 08:22:34 UTC 2015


details:   http://hg.dovecot.org/dovecot-2.2/rev/05ee9da60255
changeset: 18625:05ee9da60255
user:      Timo Sirainen <tss at iki.fi>
date:      Sun May 10 11:20:37 2015 +0300
description:
lib-http: http-server now always creates a payload istream, even empty one.
This simplifies the caller's logic so that it doesn't need to explicitly
check if payload is NULL everywhere.

diffstat:

 src/lib-http/http-server-connection.c |  13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diffs (24 lines):

diff -r 3903badc4ee0 -r 05ee9da60255 src/lib-http/http-server-connection.c
--- a/src/lib-http/http-server-connection.c	Sat May 09 21:22:50 2015 +0300
+++ b/src/lib-http/http-server-connection.c	Sun May 10 11:20:37 2015 +0300
@@ -296,12 +296,15 @@
 		   actual payload stream. */
 		conn->incoming_payload = req->req.payload =
 			i_stream_create_limit(req->req.payload, (uoff_t)-1);
-		i_stream_add_destroy_callback(req->req.payload,
-					      http_server_payload_destroyed, req);
-		/* the callback may add its own I/O, so we need to remove
-		   our one before calling it */
-		http_server_connection_input_halt(conn);
+	} else {
+		conn->incoming_payload = req->req.payload =
+			i_stream_create_from_data("", 0);
 	}
+	i_stream_add_destroy_callback(req->req.payload,
+				      http_server_payload_destroyed, req);
+	/* the callback may add its own I/O, so we need to remove
+	   our one before calling it */
+	http_server_connection_input_halt(conn);
 
 	http_server_connection_request_callback(conn, req);
 	if (conn->closed) {


More information about the dovecot-cvs mailing list