From 3033f79529106feab29901fe53064fe5e9a75b6d Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 8 Apr 2022 20:48:57 +0200 Subject: [PATCH] head fixings --- src/Model/Profile.php | 4 +++- src/Util/ParseUrl.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Model/Profile.php b/src/Model/Profile.php index 2b2c1ac97d..5fbfc4ba5a 100644 --- a/src/Model/Profile.php +++ b/src/Model/Profile.php @@ -35,6 +35,8 @@ use Friendica\Core\System; use Friendica\Core\Worker; use Friendica\Database\DBA; use Friendica\DI; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; +use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Network\HTTPException; use Friendica\Protocol\Activity; use Friendica\Protocol\Diaspora; @@ -749,7 +751,7 @@ class Profile $magic_path = $basepath . '/magic' . '?owa=1&dest=' . $dest . '&' . $addr_request; // We have to check if the remote server does understand /magic without invoking something - $serverret = DI::httpClient()->head($basepath . '/magic'); + $serverret = DI::httpClient()->head($basepath . '/magic', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::HTML]); if ($serverret->isSuccess()) { Logger::info('Doing magic auth for visitor ' . $my_url . ' to ' . $magic_path); System::externalRedirect($magic_path); diff --git a/src/Util/ParseUrl.php b/src/Util/ParseUrl.php index f3831b52e7..1cc35fadcc 100644 --- a/src/Util/ParseUrl.php +++ b/src/Util/ParseUrl.php @@ -61,7 +61,7 @@ class ParseUrl */ public static function getContentType(string $url, string $accept = HttpClientAccept::DEFAULT) { - $curlResult = DI::httpClient()->head($url); + $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)) { -- 2.39.5