dovecot-2.2: lib-http: If http_client_request_set_payload() fail...

dovecot at dovecot.org dovecot at dovecot.org
Mon Feb 4 22:07:19 EET 2013


details:   http://hg.dovecot.org/dovecot-2.2/rev/e4fbb3a834a7
changeset: 15732:e4fbb3a834a7
user:      Timo Sirainen <tss at iki.fi>
date:      Mon Feb 04 22:07:14 2013 +0200
description:
lib-http: If http_client_request_set_payload() fails to get stream size, log an error.

diffstat:

 src/lib-http/http-client-request.c |  8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diffs (23 lines):

diff -r 6a6472846181 -r e4fbb3a834a7 src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Mon Feb 04 22:03:10 2013 +0200
+++ b/src/lib-http/http-client-request.c	Mon Feb 04 22:07:14 2013 +0200
@@ -133,12 +133,18 @@
 void http_client_request_set_payload(struct http_client_request *req,
 				     struct istream *input, bool sync)
 {
+	int ret;
+
 	i_assert(req->state == HTTP_REQUEST_STATE_NEW);
 	i_assert(req->payload_input == NULL);
 
 	i_stream_ref(input);
 	req->payload_input = input;
-	if (i_stream_get_size(input, TRUE, &req->payload_size) <= 0) {
+	if ((ret = i_stream_get_size(input, TRUE, &req->payload_size)) <= 0) {
+		if (ret < 0) {
+			i_error("i_stream_get_size(%s) failed: %m",
+				i_stream_get_name(input));
+		}
 		req->payload_size = 0;
 		req->payload_chunked = TRUE;
 	}


More information about the dovecot-cvs mailing list