From 9a3bee99808338d492b74b0946540f188c99d6d0 Mon Sep 17 00:00:00 2001 From: Michael Kaufmann Date: Mon, 10 Nov 2025 20:17:43 +0100 Subject: [PATCH] md_curl: reset curl handle before reusing it --- src/md_curl.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/md_curl.c b/src/md_curl.c index e6a3717..fac2ab8 100644 --- a/src/md_curl.c +++ b/src/md_curl.c @@ -255,17 +255,19 @@ static apr_status_t internals_setup(md_http_request_t *req) rv = APR_EGENERAL; goto leave; } - curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_cb); - curl_easy_setopt(curl, CURLOPT_HEADERDATA, NULL); - curl_easy_setopt(curl, CURLOPT_READFUNCTION, req_data_cb); - curl_easy_setopt(curl, CURLOPT_READDATA, NULL); - curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, resp_data_cb); - curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL); } else { md_log_perror(MD_LOG_MARK, MD_LOG_TRACE3, 0, req->pool, "reusing curl instance from http"); + curl_easy_reset(curl); } + curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, header_cb); + curl_easy_setopt(curl, CURLOPT_HEADERDATA, NULL); + curl_easy_setopt(curl, CURLOPT_READFUNCTION, req_data_cb); + curl_easy_setopt(curl, CURLOPT_READDATA, NULL); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, resp_data_cb); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL); + internals = apr_pcalloc(req->pool, sizeof(*internals)); internals->curl = curl;