]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: client - Don't unlock connection output before request is fully sent
authorStephan Bosch <stephan.bosch@open-xchange.com>
Wed, 25 Jan 2023 04:18:10 +0000 (05:18 +0100)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Mon, 30 Jan 2023 19:48:46 +0000 (19:48 +0000)
This could happen at least when the payload is empty and the final LF was
buffered.

src/lib-http/http-client-request.c

index 5ec4a8ef688ca2384580dfddac45d77f409035fa..7e578a618684573e576e53e64aec4b2ce0ded9b0 100644 (file)
@@ -1073,6 +1073,13 @@ http_client_request_finish_payload_out(struct http_client_request *req)
                o_stream_unref(&req->payload_output);
                req->payload_output = NULL;
        }
+       if (conn->conn.output != NULL &&
+           o_stream_get_buffer_used_size(conn->conn.output) > 0) {
+               e_debug(req->event,
+                       "Not quite finished sending request");
+               conn->output_locked = TRUE;
+               return 0;
+       }
 
        i_assert(req->request_offset < conn->conn.output->offset);
        req->bytes_out = conn->conn.output->offset - req->request_offset;