mirror of
https://github.com/nextcloud/server.git
synced 2026-06-11 01:30:50 -04:00
fix(http-client): detect brotli support via libcurl, not PHP extension
- Fixes a regression introduced in #55433. Signed-off-by: ernolf <raphael.gradenwitz@googlemail.com>
This commit is contained in:
parent
ef1bea0bfa
commit
c1cd4de1cd
2 changed files with 7 additions and 6 deletions
|
|
@ -88,7 +88,7 @@ class Client implements IClient {
|
|||
$headers = $options[RequestOptions::HEADERS] ?? [];
|
||||
if (!isset($headers['Accept-Encoding'])) {
|
||||
$acceptEnc = 'gzip';
|
||||
if (function_exists('brotli_uncompress')) {
|
||||
if ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) {
|
||||
$acceptEnc = 'br, ' . $acceptEnc;
|
||||
}
|
||||
$options[RequestOptions::HEADERS] = $headers; // ensure headers are present
|
||||
|
|
|
|||
|
|
@ -288,7 +288,7 @@ class ClientTest extends \Test\TestCase {
|
|||
$this->serverVersion->method('getVersionString')
|
||||
->willReturn('123.45.6');
|
||||
|
||||
$acceptEnc = function_exists('brotli_uncompress') ? 'br, gzip' : 'gzip';
|
||||
$acceptEnc = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
|
||||
$this->defaultRequestOptions = [
|
||||
'verify' => '/my/path.crt',
|
||||
'proxy' => [
|
||||
|
|
@ -495,7 +495,7 @@ class ClientTest extends \Test\TestCase {
|
|||
$this->serverVersion->method('getVersionString')
|
||||
->willReturn('123.45.6');
|
||||
|
||||
$acceptEnc = function_exists('brotli_uncompress') ? 'br, gzip' : 'gzip';
|
||||
$acceptEnc = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
|
||||
|
||||
$this->assertEquals([
|
||||
'verify' => \OC::$SERVERROOT . '/resources/config/ca-bundle.crt',
|
||||
|
|
@ -553,7 +553,7 @@ class ClientTest extends \Test\TestCase {
|
|||
$this->serverVersion->method('getVersionString')
|
||||
->willReturn('123.45.6');
|
||||
|
||||
$acceptEnc = function_exists('brotli_uncompress') ? 'br, gzip' : 'gzip';
|
||||
$acceptEnc = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
|
||||
|
||||
$this->assertEquals([
|
||||
'verify' => '/my/path.crt',
|
||||
|
|
@ -615,7 +615,7 @@ class ClientTest extends \Test\TestCase {
|
|||
$this->serverVersion->method('getVersionString')
|
||||
->willReturn('123.45.6');
|
||||
|
||||
$acceptEnc = function_exists('brotli_uncompress') ? 'br, gzip' : 'gzip';
|
||||
$acceptEnc = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
|
||||
|
||||
$this->assertEquals([
|
||||
'verify' => '/my/path.crt',
|
||||
|
|
@ -680,11 +680,12 @@ class ClientTest extends \Test\TestCase {
|
|||
$this->serverVersion->method('getVersionString')
|
||||
->willReturn('123.45.6');
|
||||
|
||||
$acceptEnc = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
|
||||
$this->assertEquals([
|
||||
'verify' => '/my/path.crt',
|
||||
'headers' => [
|
||||
'User-Agent' => $userAgent,
|
||||
'Accept-Encoding' => 'gzip',
|
||||
'Accept-Encoding' => $acceptEnc,
|
||||
],
|
||||
'timeout' => 30,
|
||||
'nextcloud' => [
|
||||
|
|
|
|||
Loading…
Reference in a new issue