Try to fix httpfetch method bug

see #14394
This commit is contained in:
sfan5 2024-03-06 19:16:42 +01:00
parent 178943b4b7
commit 0d817ff4ff
1 changed files with 6 additions and 5 deletions

View File

@ -229,9 +229,8 @@ HTTPFetchOngoing::HTTPFetchOngoing(const HTTPFetchRequest &request_,
oss(std::ios::binary)
{
curl = pool->alloc();
if (curl == NULL) {
if (!curl)
return;
}
// Set static cURL options
curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
@ -417,10 +416,12 @@ HTTPFetchOngoing::~HTTPFetchOngoing()
// Set safe options for the reusable cURL handle
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION,
httpfetch_discardfunction);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, NULL);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, NULL);
curl_easy_setopt(curl, CURLOPT_USERAGENT, nullptr);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, nullptr);
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, nullptr);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, nullptr);
if (http_header) {
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, NULL);
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, nullptr);
curl_slist_free_all(http_header);
}
if (multipart_mime) {