[HttpClient] fix capturing SSL certificates with NativeHttpClient

This commit is contained in:
Nicolas Grekas 2020-01-02 11:45:12 +01:00
parent f3d8fd2521
commit 234589a753

View File

@ -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];