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
parent ef1bea0bfa
commit c1cd4de1cd
No known key found for this signature in database
GPG key ID: 0B145139A170715C
2 changed files with 7 additions and 6 deletions

View file

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

View file

@ -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' => [