From 234589a753e9a7eabe9444c735b4b362a95c1cb1 Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Thu, 2 Jan 2020 11:45:12 +0100 Subject: [PATCH] [HttpClient] fix capturing SSL certificates with NativeHttpClient --- .../Component/HttpClient/Response/NativeResponse.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/HttpClient/Response/NativeResponse.php b/src/Symfony/Component/HttpClient/Response/NativeResponse.php index 49e25c51bc..383603dd28 100644 --- a/src/Symfony/Component/HttpClient/Response/NativeResponse.php +++ b/src/Symfony/Component/HttpClient/Response/NativeResponse.php @@ -158,13 +158,13 @@ final class NativeResponse implements ResponseInterface restore_error_handler(); } - stream_set_blocking($h, false); - $this->context = $this->resolveRedirect = null; - - if (isset($context['ssl']['peer_certificate_chain'])) { + if (isset($context['ssl']['capture_peer_cert_chain']) && isset(($context = stream_context_get_options($this->context))['ssl']['peer_certificate_chain'])) { $this->info['peer_certificate_chain'] = $context['ssl']['peer_certificate_chain']; } + stream_set_blocking($h, false); + $this->context = $this->resolveRedirect = null; + // Create dechunk and inflate buffers if (isset($this->headers['content-length'])) { $this->remaining = (int) $this->headers['content-length'][0];