bug #35168 [HttpClient] fix capturing SSL certificates with NativeHttpClient (nicolas-grekas)

This PR was merged into the 4.3 branch.

Discussion
----------

[HttpClient] fix capturing SSL certificates with NativeHttpClient

| Q             | A
| ------------- | ---
| Branch?       | 4.3
| Bug fix?      | yes
| New feature?  | no
| Deprecations? | no
| Tickets       | -
| License       | MIT
| Doc PR        | -

Commits
-------

234589a753 [HttpClient] fix capturing SSL certificates with NativeHttpClient
This commit is contained in:
Nicolas Grekas 2020-01-04 13:28:10 +01:00
commit cf83c608d3

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