8000 [HttpClient] make `HttpClient::create()` return an `AmpHttpClient` wh… · symfony/symfony@48a664f · GitHub
[go: up one dir, main page]

Skip to content

Commit 48a664f

Browse files
[HttpClient] make HttpClient::create() return an AmpHttpClient when possible and curl is missing
1 parent f632b76 commit 48a664f

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/Symfony/Component/HttpClient/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
8000
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ CHANGELOG
77
* added `NoPrivateNetworkHttpClient` decorator
88
* added `AmpHttpClient`, a portable HTTP/2 implementation based on Amp
99
* added `LoggerAwareInterface` to `ScopingHttpClient` and `TraceableHttpClient`
10+
* made `HttpClient::create()` return an `AmpHttpClient` when `amphp/http-client` is found but curl is not
1011

1112
4.4.0
1213
-----

src/Symfony/Component/HttpClient/HttpClient.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Component\HttpClient;
1313

14+
use Amp\Http\Client\Connection\ConnectionLimitingPool;
1415
use Symfony\Contracts\HttpClient\HttpClientInterface;
1516

1617
/**
@@ -35,6 +36,8 @@ public static function create(array $defaultOptions = [], int $maxHostConnection
3536
}
3637

3738
@trigger_error('Configure the "curl.cainfo", "openssl.cafile" or "openssl.capath" php.ini setting to enable the CurlHttpClient', E_USER_WARNING);
39+
} elseif (class_exists(ConnectionLimitingPool::class)) {
40+
return new AmpHttpClient($defaultOptions, $maxHostConnections, $maxPendingPushes);
3841
}
3942

4043
return new NativeHttpClient($defaultOptions, $maxHostConnections);

0 commit comments

Comments
 (0)
0