head fixings

This commit is contained in:
Philipp Holzer 2022-04-08 20:48:57 +02:00
parent 8e2cc678dc
commit 3033f79529
Signed by: nupplaPhil
GPG Key ID: 24A7501396EB5432
2 changed files with 4 additions and 2 deletions

View File

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

View File

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