From 8e2cc678dc38b3e3447baf587668f2c97b0f5478 Mon Sep 17 00:00:00 2001 From: Philipp Date: Fri, 8 Apr 2022 20:41:25 +0200 Subject: [PATCH] head fixings --- mod/redir.php | 4 +++- src/Model/Post/Link.php | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/mod/redir.php b/mod/redir.php index d6896f3a80..ba1b7e13b6 100644 --- a/mod/redir.php +++ b/mod/redir.php @@ -27,6 +27,8 @@ use Friendica\Database\DBA; use Friendica\DI; use Friendica\Model\Contact; use Friendica\Model\Profile; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; +use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Util\Strings; function redir_init(App $a) { @@ -142,7 +144,7 @@ function redir_magic($a, $cid, $url) } // Test for magic auth on the target system - $serverret = DI::httpClient()->head($basepath . '/magic'); + $serverret = DI::httpClient()->head($basepath . '/magic', [HttpClientOptions::ACCEPT_CONTENT => HttpClientAccept::HTML]); if ($serverret->isSuccess()) { $separator = strpos($target_url, '?') ? '&' : '?'; $target_url .= $separator . 'zrl=' . urlencode($visitor) . '&addr=' . urlencode($contact_url); diff --git a/src/Model/Post/Link.php b/src/Model/Post/Link.php index cc93398a46..fb7d0edb8d 100644 --- a/src/Model/Post/Link.php +++ b/src/Model/Post/Link.php @@ -101,7 +101,7 @@ class Link { $timeout = DI::config()->get('system', 'xrd_timeout'); - $curlResult = DI::httpClient()->head($url, $accept, [HttpClientOptions::TIMEOUT => $timeout]); + $curlResult = DI::httpClient()->head($url, [HttpClientOptions::TIMEOUT => $timeout, HttpClientOptions::ACCEPT_CONTENT => $accept]); if ($curlResult->isSuccess()) { if (empty($media['mimetype'])) { return $curlResult->getHeader('Content-Type')[0] ?? '';