]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
lib-http: http-client-request - Fix pipeline corruption occurring after 100 Continue...
authorStephan Bosch <stephan.bosch@open-xchange.com>
Thu, 20 May 2021 01:04:35 +0000 (03:04 +0200)
committeraki.tuomi <aki.tuomi@open-xchange.com>
Fri, 7 Mar 2025 14:56:56 +0000 (14:56 +0000)
Only unlock connection output when no more requests are pending. Before, the
next request header could be sent while outgoing payload for current request was
still pending.

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

index ebb08f8371a4175321a9e56e7f7410278a7ae2b1..f8a748f0bb7e8d885ac649e15f4108d5cae220e2 100644 (file)
@@ -1623,6 +1623,7 @@ http_client_request_1xx_response(struct http_client_request *req,
                        return -1;
                }
 
+               i_assert(conn->output_locked);
                if (conn->conn.output != NULL)
                        o_stream_set_flush_pending(conn->conn.output, TRUE);
                return -1;
@@ -1665,7 +1666,8 @@ int http_client_request_check_response(struct http_client_request *req,
                timeval_diff_msecs(&req->sent_time, &req->submit_time));
 
        /* Make sure connection output is unlocked if 100-continue failed */
-       if (req->payload_sync && !req->payload_sync_continue) {
+       if (req->payload_sync && !req->payload_sync_continue &&
+           array_count(&conn->request_wait_list) == 1) {
                e_debug(req->event, "Unlocked output");
                conn->output_locked = FALSE;
        }