[HttpClient] Support for cURL handler objects.
This commit is contained in:
parent
aeb0946df0
commit
7ccc2e1f28
@ -337,7 +337,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
$this->multi->dnsCache->evictions = $this->multi->dnsCache->evictions ?: $this->multi->dnsCache->removals;
|
||||
$this->multi->dnsCache->removals = $this->multi->dnsCache->hostnames = [];
|
||||
|
||||
if (\is_resource($this->multi->handle)) {
|
||||
if (\is_resource($this->multi->handle) || $this->multi->handle instanceof \CurlMultiHandle) {
|
||||
if (\defined('CURLMOPT_PUSHFUNCTION')) {
|
||||
curl_multi_setopt($this->multi->handle, CURLMOPT_PUSHFUNCTION, null);
|
||||
}
|
||||
@ -347,7 +347,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface,
|
||||
}
|
||||
|
||||
foreach ($this->multi->openHandles as [$ch]) {
|
||||
if (\is_resource($ch)) {
|
||||
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
|
||||
curl_setopt($ch, CURLOPT_VERBOSE, false);
|
||||
}
|
||||
}
|
||||
|
@ -20,7 +20,7 @@ namespace Symfony\Component\HttpClient\Internal;
|
||||
*/
|
||||
final class CurlClientState extends ClientState
|
||||
{
|
||||
/** @var resource */
|
||||
/** @var \CurlMultiHandle|resource */
|
||||
public $handle;
|
||||
/** @var PushedResponse[] */
|
||||
public $pushedResponses = [];
|
||||
|
@ -36,13 +36,15 @@ final class CurlResponse implements ResponseInterface
|
||||
private $debugBuffer;
|
||||
|
||||
/**
|
||||
* @param \CurlHandle|resource|string $ch
|
||||
*
|
||||
* @internal
|
||||
*/
|
||||
public function __construct(CurlClientState $multi, $ch, array $options = null, LoggerInterface $logger = null, string $method = 'GET', callable $resolveRedirect = null, int $curlVersion = null)
|
||||
{
|
||||
$this->multi = $multi;
|
||||
|
||||
if (\is_resource($ch)) {
|
||||
if (\is_resource($ch) || $ch instanceof \CurlHandle) {
|
||||
unset($multi->handlesActivity[(int) $ch]);
|
||||
$this->handle = $ch;
|
||||
$this->debugBuffer = fopen('php://temp', 'w+');
|
||||
|
@ -50,7 +50,7 @@ trait ResponseTrait
|
||||
'canceled' => false,
|
||||
];
|
||||
|
||||
/** @var resource */
|
||||
/** @var object|resource */
|
||||
private $handle;
|
||||
private $id;
|
||||
private $timeout = 0;
|
||||
|
Reference in New Issue
Block a user