]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ParseUrl.php
Merge pull request #11662 from MrPetovan/bug/11661-splitattachment-null
[friendica.git] / src / Util / ParseUrl.php
index e1adc7dbdd505c990dbdc03f67e87d17adc046a0..f4c78df8a5772ae381bb3dd5a6eb98edd3c85b6d 100644 (file)
@@ -59,9 +59,9 @@ class ParseUrl
         * @param string $accept content-type to accept
         * @return array content type
         */
-       public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT)
+       public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT): array
        {
-               $curlResult = DI::httpClient()->head($url, $accept);
+               $curlResult = DI::httpClient()->head($url, [HttpClientOptions::ACCEPT_CONTENT => $accept]);
 
                // Workaround for systems that can't handle a HEAD request
                if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
@@ -69,6 +69,7 @@ class ParseUrl
                }
 
                if (!$curlResult->isSuccess()) {
+                       Logger::debug('Got HTTP Error', ['http error' => $curlResult->getReturnCode(), 'url' => $url]);
                        return [];
                }