head fixings

This commit is contained in:
Philipp 2022-04-08 20:41:25 +02:00
parent 277cd51433
commit 8e2cc678dc
No known key found for this signature in database
GPG Key ID: 24A7501396EB5432
2 changed files with 4 additions and 2 deletions

View File

@ -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);

View File

@ -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] ?? '';