Skip to content

Commit 48adfb2

Browse files
Merge branch '5.1'
* 5.1: [HttpClient] fix unsetting context[ssl][peer_name]
2 parents 73ca97c + 56679fe commit 48adfb2

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/Symfony/Component/HttpClient/Response/NativeResponse.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,11 @@ private function open(): void
144144
$this->info['request_header'] = sprintf("> %s %s HTTP/%s \r\n", $context['http']['method'], $this->info['request_header'], $context['http']['protocol_version']);
145145
$this->info['request_header'] .= implode("\r\n", $context['http']['header'])."\r\n\r\n";
146146

147+
if (\array_key_exists('peer_name', $context['ssl']) && null === $context['ssl']['peer_name']) {
148+
unset($context['ssl']['peer_name']);
149+
$this->context = stream_context_create([], ['options' => $context] + stream_context_get_params($this->context));
150+
}
151+
147152
// Send request and follow redirects when needed
148153
$this->handle = $h = fopen($url, 'r', false, $this->context);
149154
self::addResponseHeaders($http_response_header, $this->info, $this->headers, $this->info['debug']);

0 commit comments

Comments
 (0)