]> git.mxchange.org Git - friendica.git/blobdiff - src/Util/ParseUrl.php
Merge pull request #11150 from annando/user-banner
[friendica.git] / src / Util / ParseUrl.php
index 04afc927ba6cec4229c8167a6bcafe66e4c317d9..2763f56abf52aefc8090779b7fca8090906478ab 100644 (file)
@@ -60,6 +60,12 @@ class ParseUrl
        public static function getContentType(string $url)
        {
                $curlResult = DI::httpClient()->head($url);
+
+               // Workaround for systems that can't handle a HEAD request
+               if (!$curlResult->isSuccess() && ($curlResult->getReturnCode() == 405)) {
+                       $curlResult = DI::httpClient()->get($url, [HttpClientOptions::CONTENT_LENGTH => 1000000]);
+               }
+
                if (!$curlResult->isSuccess()) {
                        return [];
                }