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:
ernolf 2026-05-09 03:23:27 +02:00 committed by backportbot[bot]
parent 75aef85d5b
commit 35dd600e47
2 changed files with 5 additions and 5 deletions

View file

@ -94,7 +94,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

View file

@ -284,7 +284,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' => [
@ -488,7 +488,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',
@ -544,7 +544,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',
@ -604,7 +604,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',