dovecot-2.2: lib-http: http_client_request_finish_payload() no l...

dovecot at dovecot.org dovecot at dovecot.org
Thu Apr 17 08:30:11 UTC 2014


details:   http://hg.dovecot.org/dovecot-2.2/rev/f68ec8bd4afa
changeset: 17230:f68ec8bd4afa
user:      Timo Sirainen <tss at iki.fi>
date:      Thu Apr 17 10:17:09 2014 +0200
description:
lib-http: http_client_request_finish_payload() no longer waits for the entire result payload.
The caller can now read it instead, or just discard it by not reading it.

diffstat:

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

diffs (34 lines):

diff -r 8618c884170d -r f68ec8bd4afa src/lib-http/http-client-request.c
--- a/src/lib-http/http-client-request.c	Thu Apr 17 09:45:55 2014 +0200
+++ b/src/lib-http/http-client-request.c	Thu Apr 17 10:17:09 2014 +0200
@@ -485,7 +485,7 @@
 	client->ioloop = io_loop_create();
 	http_client_switch_ioloop(client);
 
-	while (req->state < HTTP_REQUEST_STATE_FINISHED) {
+	while (req->state < HTTP_REQUEST_STATE_PAYLOAD_IN) {
 		http_client_request_debug(req, "Waiting for request to finish");
 		
 		if (req->state == HTTP_REQUEST_STATE_PAYLOAD_OUT)
@@ -505,10 +505,18 @@
 	io_loop_set_current(client->ioloop);
 	io_loop_destroy(&client->ioloop);
 
-	if (req->state == HTTP_REQUEST_STATE_FINISHED)
+	switch (req->state) {
+	case HTTP_REQUEST_STATE_PAYLOAD_IN:
+	case HTTP_REQUEST_STATE_FINISHED:
 		ret = 1;
-	else
-		ret = (req->state == HTTP_REQUEST_STATE_ABORTED ? -1 : 0);
+		break;
+	case HTTP_REQUEST_STATE_ABORTED:
+		ret = -1;
+		break;
+	default:
+		ret = 0;
+		break;
+	}
 
 	req->payload_wait = FALSE;
 	http_client_request_unref(_req);


More information about the dovecot-cvs mailing list