From fed7149e938db88d1f1c6416a20164799f7ff397 Mon Sep 17 00:00:00 2001 From: iglocska Date: Fri, 22 Mar 2024 15:04:57 +0100 Subject: [PATCH] fix: [curlclient] HEAD failing - added CURLOPT_NOBODY for HEAD requests, as described in https://www.php.net/manual/en/function.curl-setopt.php --- app/Lib/Tools/CurlClient.php | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/app/Lib/Tools/CurlClient.php b/app/Lib/Tools/CurlClient.php index 100a8215b..105a09d70 100644 --- a/app/Lib/Tools/CurlClient.php +++ b/app/Lib/Tools/CurlClient.php @@ -202,6 +202,10 @@ class CurlClient extends HttpSocketExtended $options[CURLOPT_POSTFIELDS] = $query; } + if ($method === 'HEAD') { + $options[CURLOPT_NOBODY] = true; + } + if (!empty($request['header'])) { $headers = []; foreach ($request['header'] as $key => $value) { @@ -231,7 +235,6 @@ class CurlClient extends HttpSocketExtended } return $len; }; - if (!curl_setopt_array($this->ch, $options)) { throw new \RuntimeException('curl error: Could not set options'); }