From: Stephan Bosch Date: Tue, 1 Dec 2020 09:25:09 +0000 (+0100) Subject: lib-http: http-client-request - Fix payload assertions in http_client_request_send_mo... X-Git-Tag: 2.3.14.rc1~288 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=043d111cea78533cf22d3bfe0872c8376d842f56;p=thirdparty%2Fdovecot%2Fcore.git lib-http: http-client-request - Fix payload assertions in http_client_request_send_more(). When the request payload is finished, both req->payload_input and req->payload_output could be NULL, so the assertions on those being not NULL need to happen after the check for req->payload_finished. This particularly causes problems with the blocking http_client_request_send/finish_payload() API, which constantly modifies req->payload_input and sets it to NULL to finish the output. This caused a panic: Panic: file http-client-request.c: line 1232 (http_client_request_send_more): assertion failed: (req->payload_input != NULL) --- diff --git a/src/lib-http/http-client-request.c b/src/lib-http/http-client-request.c index 250417c93a..0a471f7f5d 100644 --- a/src/lib-http/http-client-request.c +++ b/src/lib-http/http-client-request.c @@ -1234,12 +1234,12 @@ int http_client_request_send_more(struct http_client_request *req, const char *error; uoff_t offset; - i_assert(req->payload_input != NULL); - i_assert(req->payload_output != NULL); - if (req->payload_finished) return http_client_request_finish_payload_out(req); + i_assert(req->payload_input != NULL); + i_assert(req->payload_output != NULL); + io_remove(&conn->io_req_payload); /* Chunked ostream needs to write to the parent stream's buffer */