]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Fixed assert failure occurring when server returns error status...
authorStephan Bosch <stephan.bosch@dovecot.fi>
Tue, 8 Nov 2016 23:46:32 +0000 (00:46 +0100)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Wed, 9 Nov 2016 12:28:23 +0000 (14:28 +0200)
src/lib-http/http-client-request.c

index 87de47a7f946c5889c6edac2a38c8557237cd1ea..414246d006a2fbc630d141b59fc67f83cce7a43c 100644 (file)
@@ -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;