From c3d4e1741aae273208e2ed1b526b3e6712000e3b Mon Sep 17 00:00:00 2001 From: Stephan Bosch Date: Thu, 20 May 2021 03:04:35 +0200 Subject: [PATCH] lib-http: http-client-request - Fix pipeline corruption occurring after 100 Continue response 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 | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index ebb08f8371..f8a748f0bb 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -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; } -- 2.47.3