diff --git a/dwpost/dwpost.php b/dwpost/dwpost.php index 286d80127..bab93dff9 100644 --- a/dwpost/dwpost.php +++ b/dwpost/dwpost.php @@ -17,6 +17,7 @@ use Friendica\DI; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -192,7 +193,7 @@ EOT; Logger::debug('dwpost: data: ' . $xml); if ($dw_blog !== 'test') { - $x = DI::httpClient()->post($dw_blog, $xml, ['Content-Type' => 'text/xml'])->getBody(); + $x = DI::httpClient()->post($dw_blog, $xml, HttpClientAccept::DEFAULT, ['Content-Type' => 'text/xml'])->getBody(); } Logger::info('posted to dreamwidth: ' . ($x) ? $x : ''); diff --git a/ijpost/ijpost.php b/ijpost/ijpost.php index 79cd75c89..832dff2c7 100644 --- a/ijpost/ijpost.php +++ b/ijpost/ijpost.php @@ -16,6 +16,7 @@ use Friendica\Core\Renderer; use Friendica\DI; use Friendica\Model\Tag; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -186,7 +187,7 @@ EOT; Logger::debug('ijpost: data: ' . $xml); if ($ij_blog !== 'test') { - $x = DI::httpClient()->post($ij_blog, $xml, ['Content-Type' => 'text/xml'])->getBody(); + $x = DI::httpClient()->post($ij_blog, $xml, HttpClientAccept::DEFAULT, ['Content-Type' => 'text/xml'])->getBody(); } Logger::info('posted to insanejournal: ' . $x ? $x : ''); } diff --git a/ljpost/ljpost.php b/ljpost/ljpost.php index 073a977e8..2fa5e782b 100644 --- a/ljpost/ljpost.php +++ b/ljpost/ljpost.php @@ -17,6 +17,7 @@ use Friendica\DI; use Friendica\Model\Post; use Friendica\Model\Tag; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Util\DateTimeFormat; use Friendica\Util\XML; @@ -206,7 +207,7 @@ EOT; Logger::debug('ljpost: data: ' . $xml); if ($lj_blog !== 'test') { - $x = DI::httpClient()->post($lj_blog, $xml, ['Content-Type' => 'text/xml'])->getBody(); + $x = DI::httpClient()->post($lj_blog, $xml, HttpClientAccept::DEFAULT, ['Content-Type' => 'text/xml'])->getBody(); } Logger::info('posted to livejournal: ' . ($x) ? $x : ''); } diff --git a/mailstream/mailstream.php b/mailstream/mailstream.php index 33959e1e5..60d6412b4 100644 --- a/mailstream/mailstream.php +++ b/mailstream/mailstream.php @@ -19,6 +19,7 @@ use Friendica\Model\Contact; use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; @@ -207,7 +208,7 @@ function mailstream_do_images(&$item, &$attachments) continue; } $cookiejar = tempnam(System::getTempPath(), 'cookiejar-mailstream-'); - $curlResult = DI::httpClient()->fetchFull($url, 0, '', $cookiejar); + $curlResult = DI::httpClient()->fetchFull($url, HttpClientAccept::DEFAULT, 0, $cookiejar); $attachments[$url] = [ 'data' => $curlResult->getBody(), 'guid' => hash("crc32", $url), diff --git a/pumpio/pumpio.php b/pumpio/pumpio.php index 62ad77120..1253d376a 100644 --- a/pumpio/pumpio.php +++ b/pumpio/pumpio.php @@ -22,6 +22,7 @@ use Friendica\Model\Group; use Friendica\Model\Item; use Friendica\Model\Post; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Protocol\Activity; use Friendica\Protocol\ActivityNamespace; @@ -1487,7 +1488,7 @@ function pumpio_fetchallcomments(App $a, $uid, $id) function pumpio_reachable($url) { - return DI::httpClient()->get($url, [HttpClientOptions::TIMEOUT => 10])->isSuccess(); + return DI::httpClient()->get($url, HttpClientAccept::DEFAULT, [HttpClientOptions::TIMEOUT => 10])->isSuccess(); } /* diff --git a/statusnet/statusnet.php b/statusnet/statusnet.php index b2582b86e..6fc1469c2 100644 --- a/statusnet/statusnet.php +++ b/statusnet/statusnet.php @@ -56,6 +56,7 @@ use Friendica\Model\Item; use Friendica\Model\Photo; use Friendica\Model\Post; use Friendica\Model\User; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Protocol\Activity; use Friendica\Util\DateTimeFormat; use Friendica\Util\Strings; @@ -1367,7 +1368,7 @@ function statusnet_convertmsg(App $a, $body) } elseif ($oembed_data->type != "link") { $body = str_replace($search, "[url=" . $expanded_url . "]" . $expanded_url . "[/url]", $body); } else { - $img_str = DI::httpClient()->fetch($expanded_url, 4); + $img_str = DI::httpClient()->fetch($expanded_url, HttpClientAccept::DEFAULT, 4); $tempfile = tempnam(System::getTempPath(), "cache"); file_put_contents($tempfile, $img_str); diff --git a/webdav_storage/src/WebDav.php b/webdav_storage/src/WebDav.php index de9fc4769..2e6b5b4e5 100644 --- a/webdav_storage/src/WebDav.php +++ b/webdav_storage/src/WebDav.php @@ -6,6 +6,7 @@ use Exception; use Friendica\Core\Storage\Capability\ICanWriteToStorage; use Friendica\Core\Storage\Exception\ReferenceStorageException; use Friendica\Core\Storage\Exception\StorageException; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; use Friendica\Util\Strings; @@ -85,7 +86,7 @@ class WebDav implements ICanWriteToStorage */ protected function exists(string $uri): bool { - return $this->client->head($uri, [HttpClientOptions::AUTH => $this->authOptions])->getReturnCode() == 200; + return $this->client->head($uri, HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $this->authOptions])->getReturnCode() == 200; } /** @@ -110,7 +111,7 @@ class WebDav implements ICanWriteToStorage HttpClientOptions::BODY => $dom->saveXML(), ]; - $response = $this->client->request('propfind', $uri, $opts); + $response = $this->client->request('propfind', $uri, HttpClientAccept::DEFAULT, $opts); $responseDoc = new \DOMDocument(); $responseDoc->loadXML($response->getBody()); @@ -133,7 +134,7 @@ class WebDav implements ICanWriteToStorage */ protected function mkcol(string $uri): bool { - return $this->client->request('mkcol', $uri, [HttpClientOptions::AUTH => $this->authOptions]) + return $this->client->request('mkcol', $uri, HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $this->authOptions]) ->getReturnCode() == 200; } @@ -177,7 +178,7 @@ class WebDav implements ICanWriteToStorage foreach ($pathParts as $pathPart) { $checkUrl = $this->url . $partURL; if (!empty($partURL) && !$this->hasItems($checkUrl)) { - $response = $this->client->request('delete', $checkUrl, [HttpClientOptions::AUTH => $this->authOptions]); + $response = $this->client->request('delete', $checkUrl, HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $this->authOptions]); if (!$response->isSuccess()) { if ($response->getReturnCode() == "404") { @@ -199,7 +200,7 @@ class WebDav implements ICanWriteToStorage { $file = $this->pathForRef($reference); - $response = $this->client->request('get', $this->url . '/' . $file[0], [HttpClientOptions::AUTH => $this->authOptions]); + $response = $this->client->request('get', $this->url . '/' . $file[0], HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $this->authOptions]); if (!$response->isSuccess()) { throw new ReferenceStorageException(sprintf('Invalid reference %s', $reference)); @@ -229,7 +230,7 @@ class WebDav implements ICanWriteToStorage HttpClientOptions::AUTH => $this->authOptions, ]; - $this->client->request('put', $this->url . '/' . $file[0], $opts); + $this->client->request('put', $this->url . '/' . $file[0], HttpClientAccept::DEFAULT, $opts); return $reference; } @@ -241,7 +242,7 @@ class WebDav implements ICanWriteToStorage { $file = $this->pathForRef($reference); - $response = $this->client->request('delete', $this->url . '/' . $file[0], [HttpClientOptions::AUTH => $this->authOptions]); + $response = $this->client->request('delete', $this->url . '/' . $file[0], HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $this->authOptions]); if (!$response->isSuccess()) { throw new ReferenceStorageException(sprintf('Invalid reference %s', $reference)); diff --git a/webdav_storage/src/WebDavConfig.php b/webdav_storage/src/WebDavConfig.php index 2236e97ab..4a0c3c679 100644 --- a/webdav_storage/src/WebDavConfig.php +++ b/webdav_storage/src/WebDavConfig.php @@ -5,6 +5,7 @@ namespace Friendica\Addon\webdav_storage\src; use Friendica\Core\Config\Capability\IManageConfigValues; use Friendica\Core\L10n; use Friendica\Core\Storage\Capability\ICanConfigureStorage; +use Friendica\Network\HTTPClient\Client\HttpClientAccept; use Friendica\Network\HTTPClient\Client\HttpClientOptions; use Friendica\Network\HTTPClient\Capability\ICanSendHttpRequests; @@ -138,7 +139,7 @@ class WebDavConfig implements ICanConfigureStorage ]; } - if (!$this->client->head($url, [HttpClientOptions::AUTH => $options])->isSuccess()) { + if (!$this->client->head($url, HttpClientAccept::DEFAULT, [HttpClientOptions::AUTH => $options])->isSuccess()) { return [ 'url' => $this->l10n->t('url is either invalid or not reachable'), ];