From: Stephan Bosch Date: Tue, 8 Nov 2016 23:46:32 +0000 (+0100) Subject: lib-http: client: Fixed assert failure occurring when server returns error status... X-Git-Tag: 2.2.27~216 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=78d15580ea05eef62b05a3a9e1f5be49b6288616;p=thirdparty%2Fdovecot%2Fcore.git lib-http: client: Fixed assert failure occurring when server returns error status early while client is still sending blocking payload. --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 87de47a7f9..414246d006 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -824,10 +824,16 @@ int http_client_request_send_payload(struct http_client_request **_req, i_assert(data != NULL); ret = http_client_request_continue_payload(&req, data, size); - if (ret < 0) + if (ret < 0) { + /* failed to send payload */ *_req = NULL; - else { - i_assert(ret == 0); + } else if (ret > 0) { + /* premature end of request; + server sent error before all payload could be sent */ + ret = -1; + *_req = NULL; + } else { + /* not finished sending payload */ i_assert(req != NULL); } return ret;