]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client: Fixed reference counting for requests that are aborted due to havin...
authorStephan Bosch <stephan@dovecot.fi>
Thu, 19 May 2016 21:40:26 +0000 (23:40 +0200)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Mon, 20 Jun 2016 00:24:34 +0000 (03:24 +0300)
src/lib-http/http-client-request.c

index cec9748c60b9aba979411a05f5500be5f8c0e5a7..05890f512bf090965c666f8d8506f9108c6027a9 100644 (file)
@@ -788,18 +788,18 @@ int http_client_request_send_more(struct http_client_request *req,
        o_stream_set_max_buffer_size(output, (size_t)-1);
 
        if (req->payload_input->stream_errno != 0) {
-               /* the payload stream assigned to this request is broken,
-                  fail this the request immediately */
-               http_client_request_send_error(req,
-                       HTTP_CLIENT_REQUEST_ERROR_BROKEN_PAYLOAD,
-                       "Broken payload stream");
-
                /* we're in the middle of sending a request, so the connection
                   will also have to be aborted */
                errno = req->payload_input->stream_errno;
                *error_r = t_strdup_printf("read(%s) failed: %s",
                                           i_stream_get_name(req->payload_input),
                                           i_stream_get_error(req->payload_input));
+               
+               /* the payload stream assigned to this request is broken,
+                  fail this the request immediately */
+               http_client_request_error(&req,
+                       HTTP_CLIENT_REQUEST_ERROR_BROKEN_PAYLOAD,
+                       "Broken payload stream");
                return -1;
        } else if (output->stream_errno != 0) {
                /* failed to send request */