Mercurial > dovecot > core-2.2
changeset 17230:f68ec8bd4afa
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.
author | Timo Sirainen <tss@iki.fi> |
---|---|
date | Thu, 17 Apr 2014 10:17:09 +0200 |
parents | 8618c884170d |
children | e4119adae01d |
files | src/lib-http/http-client-request.c |
diffstat | 1 files changed, 12 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- 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);