[HttpClient] fix after merge from 4.3
This commit is contained in:
parent
ba1ba971d6
commit
3c6dc96ab4
@ -170,7 +170,7 @@ final class CurlHttpClient implements HttpClientInterface, LoggerAwareInterface
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!\is_string($options['auth_ntlm'])) {
|
if (!\is_string($options['auth_ntlm'])) {
|
||||||
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be string or an array, %s given.', \gettype($options['auth_ntlm'])));
|
throw new InvalidArgumentException(sprintf('Option "auth_ntlm" must be a string or an array, %s given.', \gettype($options['auth_ntlm'])));
|
||||||
}
|
}
|
||||||
|
|
||||||
$curlopts[CURLOPT_USERPWD] = $options['auth_ntlm'];
|
$curlopts[CURLOPT_USERPWD] = $options['auth_ntlm'];
|
||||||
|
@ -71,7 +71,7 @@ final class CurlResponse implements ResponseInterface
|
|||||||
// Move the pushed response to the activity list
|
// Move the pushed response to the activity list
|
||||||
$buffer = $options['buffer'];
|
$buffer = $options['buffer'];
|
||||||
|
|
||||||
if ('headers' !== curl_getinfo($ch, CURLINFO_PRIVATE)) {
|
if ('H' !== curl_getinfo($ch, CURLINFO_PRIVATE)[0]) {
|
||||||
if ($options['buffer'] instanceof \Closure) {
|
if ($options['buffer'] instanceof \Closure) {
|
||||||
try {
|
try {
|
||||||
[$content, $buffer] = [null, $content];
|
[$content, $buffer] = [null, $content];
|
||||||
@ -249,17 +249,15 @@ final class CurlResponse implements ResponseInterface
|
|||||||
*/
|
*/
|
||||||
private function close(): void
|
private function close(): void
|
||||||
{
|
{
|
||||||
if (self::$performing) {
|
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
|
||||||
$this->multi->handlesActivity[$this->id][] = null;
|
curl_setopt($this->handle, CURLOPT_PRIVATE, '_0');
|
||||||
$this->multi->handlesActivity[$this->id][] = new TransportException('Response has been canceled.');
|
|
||||||
|
|
||||||
|
if (self::$performing) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
unset($this->multi->openHandles[$this->id], $this->multi->handlesActivity[$this->id]);
|
|
||||||
curl_multi_remove_handle($this->multi->handle, $this->handle);
|
curl_multi_remove_handle($this->multi->handle, $this->handle);
|
||||||
curl_setopt_array($this->handle, [
|
curl_setopt_array($this->handle, [
|
||||||
CURLOPT_PRIVATE => '_0',
|
|
||||||
CURLOPT_NOPROGRESS => true,
|
CURLOPT_NOPROGRESS => true,
|
||||||
CURLOPT_PROGRESSFUNCTION => null,
|
CURLOPT_PROGRESSFUNCTION => null,
|
||||||
CURLOPT_HEADERFUNCTION => null,
|
CURLOPT_HEADERFUNCTION => null,
|
||||||
@ -432,7 +430,12 @@ final class CurlResponse implements ResponseInterface
|
|||||||
if (!$content && $options['buffer'] instanceof \Closure && $content = $options['buffer']($headers) ?: null) {
|
if (!$content && $options['buffer'] instanceof \Closure && $content = $options['buffer']($headers) ?: null) {
|
||||||
$content = \is_resource($content) ? $content : fopen('php://temp', 'w+');
|
$content = \is_resource($content) ? $content : fopen('php://temp', 'w+');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (null !== $info['error']) {
|
||||||
|
throw new TransportException($info['error']);
|
||||||
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
|
$multi->handlesActivity[$id] = $multi->handlesActivity[$id] ?? [new FirstChunk()];
|
||||||
$multi->handlesActivity[$id][] = null;
|
$multi->handlesActivity[$id][] = null;
|
||||||
$multi->handlesActivity[$id][] = $e;
|
$multi->handlesActivity[$id][] = $e;
|
||||||
|
|
||||||
|
@ -181,8 +181,8 @@ final class NativeResponse implements ResponseInterface
|
|||||||
$this->content = \is_resource($this->content) ? $this->content : fopen('php://temp', 'w+');
|
$this->content = \is_resource($this->content) ? $this->content : fopen('php://temp', 'w+');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!$this->buffer) {
|
if (null !== $this->info['error']) {
|
||||||
throw new TransportException('Response has been canceled.');
|
throw new TransportException($this->info['error']);
|
||||||
}
|
}
|
||||||
} catch (\Throwable $e) {
|
} catch (\Throwable $e) {
|
||||||
$this->close();
|
$this->close();
|
||||||
|
Reference in New Issue
Block a user