From 0d817ff4ff4f0bd18d3c81fd9dbd708e297b21cc Mon Sep 17 00:00:00 2001
From: sfan5 <sfan5@live.de>
Date: Wed, 6 Mar 2024 19:16:42 +0100
Subject: [PATCH] Try to fix httpfetch method bug

see #14394
---
 src/httpfetch.cpp | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/src/httpfetch.cpp b/src/httpfetch.cpp
index 2212ba453..87c1c51eb 100644
--- a/src/httpfetch.cpp
+++ b/src/httpfetch.cpp
@@ -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) {