style(http-client): use explicit bitmask comparison for CURL_VERSION_BROTLI

Signed-off-by: ernolf <raphael.gradenwitz@googlemail.com>
This commit is contained in:
ernolf 2026-05-11 14:06:57 +02:00
parent 35dd600e47
commit 78cb8c3de5
No known key found for this signature in database
GPG key ID: 0B145139A170715C
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 ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) {
if (((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) === 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 = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
$acceptEnc = (((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) === 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 = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
$acceptEnc = (((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) === 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 = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
$acceptEnc = (((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) === 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 = ((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
$acceptEnc = (((curl_version()['features'] ?? 0) & CURL_VERSION_BROTLI) === CURL_VERSION_BROTLI) ? 'br, gzip' : 'gzip';
$this->assertEquals([
'verify' => '/my/path.crt',