@@ -284,20 +284,27 @@ private function setUpDefaultRequestOptions(): void {
284284 $ this ->serverVersion ->method ('getVersionString ' )
285285 ->willReturn ('123.45.6 ' );
286286
287+ $ acceptEnc = function_exists ('brotli_uncompress ' ) ? 'br, gzip ' : 'gzip ' ;
287288 $ this ->defaultRequestOptions = [
288289 'verify ' => '/my/path.crt ' ,
289290 'proxy ' => [
290291 'http ' => 'foo ' ,
291292 'https ' => 'foo '
292293 ],
293294 'headers ' => [
295+
294296 'User-Agent ' => 'Nextcloud-Server-Crawler/123.45.6 ' ,
295- 'Accept-Encoding ' => 'gzip ' ,
297+ 'Accept-Encoding ' => $ acceptEnc ,
298+
296299 ],
297300 'timeout ' => 30 ,
298301 'nextcloud ' => [
299302 'allow_local_address ' => true ,
300303 ],
304+ 'version ' => '2.0 ' ,
305+ 'curl ' => [
306+ \CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_2TLS ,
307+ ],
301308 ];
302309 }
303310
@@ -481,11 +488,13 @@ public function testSetDefaultOptionsWithNotInstalled(): void {
481488 $ this ->serverVersion ->method ('getVersionString ' )
482489 ->willReturn ('123.45.6 ' );
483490
491+ $ acceptEnc = function_exists ('brotli_uncompress ' ) ? 'br, gzip ' : 'gzip ' ;
492+
484493 $ this ->assertEquals ([
485494 'verify ' => \OC ::$ SERVERROOT . '/resources/config/ca-bundle.crt ' ,
486495 'headers ' => [
487496 'User-Agent ' => 'Nextcloud-Server-Crawler/123.45.6 ' ,
488- 'Accept-Encoding ' => ' gzip ' ,
497+ 'Accept-Encoding ' => $ acceptEnc ,
489498 ],
490499 'timeout ' => 30 ,
491500 'nextcloud ' => [
@@ -499,6 +508,10 @@ public function testSetDefaultOptionsWithNotInstalled(): void {
499508 ): void {
500509 },
501510 ],
511+ 'version ' => '2.0 ' ,
512+ 'curl ' => [
513+ \CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_2TLS ,
514+ ],
502515 ], self ::invokePrivate ($ this ->client , 'buildRequestOptions ' , [[]]));
503516 }
504517
@@ -531,6 +544,8 @@ public function testSetDefaultOptionsWithProxy(): void {
531544 $ this ->serverVersion ->method ('getVersionString ' )
532545 ->willReturn ('123.45.6 ' );
533546
547+ $ acceptEnc = function_exists ('brotli_uncompress ' ) ? 'br, gzip ' : 'gzip ' ;
548+
534549 $ this ->assertEquals ([
535550 'verify ' => '/my/path.crt ' ,
536551 'proxy ' => [
@@ -539,7 +554,7 @@ public function testSetDefaultOptionsWithProxy(): void {
539554 ],
540555 'headers ' => [
541556 'User-Agent ' => 'Nextcloud-Server-Crawler/123.45.6 ' ,
542- 'Accept-Encoding ' => ' gzip ' ,
557+ 'Accept-Encoding ' => $ acceptEnc ,
543558 ],
544559 'timeout ' => 30 ,
545560 'nextcloud ' => [
@@ -553,6 +568,10 @@ public function testSetDefaultOptionsWithProxy(): void {
553568 ): void {
554569 },
555570 ],
571+ 'version ' => '2.0 ' ,
572+ 'curl ' => [
573+ \CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_2TLS ,
574+ ],
556575 ], self ::invokePrivate ($ this ->client , 'buildRequestOptions ' , [[]]));
557576 }
558577
@@ -585,6 +604,8 @@ public function testSetDefaultOptionsWithProxyAndExclude(): void {
585604 $ this ->serverVersion ->method ('getVersionString ' )
586605 ->willReturn ('123.45.6 ' );
587606
607+ $ acceptEnc = function_exists ('brotli_uncompress ' ) ? 'br, gzip ' : 'gzip ' ;
608+
588609 $ this ->assertEquals ([
589610 'verify ' => '/my/path.crt ' ,
590611 'proxy ' => [
@@ -594,7 +615,7 @@ public function testSetDefaultOptionsWithProxyAndExclude(): void {
594615 ],
595616 'headers ' => [
596617 'User-Agent ' => 'Nextcloud-Server-Crawler/123.45.6 ' ,
597- 'Accept-Encoding ' => ' gzip ' ,
618+ 'Accept-Encoding ' => $ acceptEnc ,
598619 ],
599620 'timeout ' => 30 ,
600621 'nextcloud ' => [
@@ -608,6 +629,10 @@ public function testSetDefaultOptionsWithProxyAndExclude(): void {
608629 ): void {
609630 },
610631 ],
632+ 'version ' => '2.0 ' ,
633+ 'curl ' => [
634+ \CURLOPT_HTTP_VERSION => \CURL_HTTP_VERSION_2TLS ,
635+ ],
611636 ], self ::invokePrivate ($ this ->client , 'buildRequestOptions ' , [[]]));
612637 }
613638}
0 commit comments