kopia lustrzana https://github.com/nextcloud/social
Merge pull request #1666 from nextcloud/fix/noid/no-headers-on-webfinger/hostmeta
ignore headerspull/1667/head
commit
c09c8f3258
|
@ -31,12 +31,12 @@ declare(strict_types=1);
|
|||
|
||||
namespace OCA\Social\Service;
|
||||
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCA\Social\Tools\Model\NCRequest;
|
||||
use OCA\Social\Tools\Model\Request;
|
||||
use OCA\Social\Tools\Traits\TArrayTools;
|
||||
use OCA\Social\Tools\Traits\TPathTools;
|
||||
use OCA\Social\AppInfo\Application;
|
||||
use OCA\Social\Exceptions\SocialAppConfigException;
|
||||
use OCP\IConfig;
|
||||
use OCP\IRequest;
|
||||
use OCP\IURLGenerator;
|
||||
|
@ -415,16 +415,19 @@ class ConfigService {
|
|||
public function configureRequest(NCRequest $request): void {
|
||||
$request->setVerifyPeer($this->getAppValue(ConfigService::SOCIAL_SELF_SIGNED) !== '1');
|
||||
|
||||
if ($request->getType() === Request::TYPE_GET) {
|
||||
$request->addHeader(
|
||||
'Accept', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
);
|
||||
}
|
||||
// do not add json headers if required
|
||||
if (!$this->getBool('ignoreJsonHeaders', $request->getClientOptions())) {
|
||||
if ($request->getType() === Request::TYPE_GET) {
|
||||
$request->addHeader(
|
||||
'Accept', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
);
|
||||
}
|
||||
|
||||
if ($request->getType() === Request::TYPE_POST) {
|
||||
$request->addHeader(
|
||||
'Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
);
|
||||
if ($request->getType() === Request::TYPE_POST) {
|
||||
$request->addHeader(
|
||||
'Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
$request->setLocalAddressAllowed(true);
|
||||
|
|
|
@ -126,6 +126,7 @@ class CurlService {
|
|||
$request = new NCRequest($path);
|
||||
$request->addParam('resource', 'acct:' . $account);
|
||||
$request->setHost($host);
|
||||
$request->setClientOptions(['ignoreJsonHeaders' => true]);
|
||||
$request->setProtocols($protocols);
|
||||
$result = $this->retrieveJson($request);
|
||||
|
||||
|
@ -152,6 +153,7 @@ class CurlService {
|
|||
$request = new NCRequest('/.well-known/host-meta');
|
||||
$request->setHost($host);
|
||||
$request->setProtocols($protocols);
|
||||
$request->setClientOptions(['ignoreJsonHeaders' => true]);
|
||||
|
||||
$this->logger->debug('hostMeta', ['host' => $host, 'protocols' => $protocols]);
|
||||
|
||||
|
|
Ładowanie…
Reference in New Issue