Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 550cc67

Browse filesBrowse files
[HttpClient] Disable HTTP/2 PUSH by default when using curl
1 parent ed17728 commit 550cc67
Copy full SHA for 550cc67

File tree

Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+12
-10
lines changed

‎CurlHttpClient.php

Copy file name to clipboardExpand all lines: CurlHttpClient.php
+1-1Lines 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.');

‎Tests/CurlHttpClientTest.php

Copy file name to clipboardExpand all lines: Tests/CurlHttpClientTest.php
+11-9Lines changed: 11 additions & 9 deletions
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)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.