Skip to content

Commit 01e10c8

Browse files
[HttpClient] fix unsetting context[ssl][peer_name]
1 parent bd3df8f commit 01e10c8

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

Response/NativeResponse.php

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

138+
if (\array_key_exists('peer_name', $context['ssl']) && null === $context['ssl']['peer_name']) {
139+
unset($context['ssl']['peer_name']);
140+
$this->context = stream_context_create([], ['options' => $context] + stream_context_get_params($this->context));
141+
}
142+
138143
// Send request and follow redirects when needed
139144
$this->handle = $h = fopen($url, 'r', false, $this->context);
140145
self::addResponseHeaders($http_response_header, $this->info, $this->headers, $this->info['debug']);

0 commit comments

Comments
 (0)