Skip to content

Commit 7187539

Browse files
minor symfony#38379 [HttpClient] fix unsetting context[ssl][peer_name] (nicolas-grekas)
This PR was merged into the 4.4 branch. Discussion ---------- [HttpClient] fix unsetting context[ssl][peer_name] | Q | A | ------------- | --- | Branch? | 4.4 | Bug fix? | no (fixing a not released fix) | New feature? | no | Deprecations? | no | Tickets | Fix symfony#38375 (comment) | License | MIT | Doc PR | - /cc @bohanyang could you please confirm this fixes it? Commits ------- 8eb8a7c [HttpClient] fix unsetting context[ssl][peer_name]
2 parents 0d8721f + 8eb8a7c commit 7187539

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
@@ -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)