8000 [HttpClient] Disable HTTP/2 PUSH by default when using curl · symfony/symfony@ae9b889 · GitHub
[go: up one dir, main page]

Skip to content

Commit ae9b889

Browse files
[HttpClient] Disable HTTP/2 PUSH by default when using curl
1 parent f3e0c81 commit ae9b889

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

src/Symfony/Component/HttpClient/CurlHttpClient.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
6767
*
6868
* @see HttpClientInterface::OPTIONS_DEFAULTS for available options
6969
*/
70-
public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 50)
70+
public function __construct(array $defaultOptions = [], int $maxHostConnections = 6, int $maxPendingPushes = 0)
7171
{
7272
if (!\extension_loaded('curl')) {
7373
throw new \LogicException('You cannot use the "Symfony\Component\HttpClient\CurlHttpClient" as the "curl" extension is not installed.');

src/Symfony/Component/HttpClient/Tests/CurlHttpClientTest.php

Lines changed: 11 additions & 9 deletions
< 8000 col width="40"/>
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,19 @@ class CurlHttpClientTest extends HttpClientTestCase
2222
{
2323
protected function getHttpClient(string $testCase): HttpClientInterface
2424
{
25-
if (false !== strpos($testCase, 'Push')) {
26-
if (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304) {
27-
$this->markTestSkipped('PHP 7.3.0 to 7.3.3 don\'t support HTTP/2 PUSH');
28-
}
29-
30-
if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > ($v = curl_version())['version_number'] || !(\CURL_VERSION_HTTP2 & $v['features'])) {
31-
$this->markTestSkipped('curl <7.61 is used or it is not compiled with support for HTTP/2 PUSH');
32-
}
25+
if (!str_contains($testCase, 'Push')) {
26+
return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false]);
3327
}
3428

35-
return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false]);
29+
if (\PHP_VERSION_ID >= 70300 && \PHP_VERSION_ID < 70304) {
30+
$this->markTestSkipped('PHP 7.3.0 to 7.3.3 don\'t support HTTP/2 PUSH');
31+
}
32+
33+
if (!\defined('CURLMOPT_PUSHFUNCTION') || 0x073D00 > ($v = curl_version())['version_number'] || !(\CURL_VERSION_HTTP2 & $v['features'])) {
34+
$this->markTestSkipped('curl <7.61 is used or it is not compiled with support for HTTP/2 PUSH');
35+
}
36+
37+
return new CurlHttpClient(['verify_peer' => false, 'verify_host' => false], 6, 50);
3638
}
3739

3840
public function testBindToPort()

0 commit comments

Comments
 (0)
0