From e9afce33341e1576c6726e9c0f5115d5cf86b260 Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Tue, 8 Jun 2021 18:37:25 +0200 Subject: [PATCH] [HttpClient] Revert bindto workaround MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit … for unaffected PHP versions Signed-off-by: Alexander M. Turek --- src/Symfony/Component/HttpClient/NativeHttpClient.php | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/Symfony/Component/HttpClient/NativeHttpClient.php b/src/Symfony/Component/HttpClient/NativeHttpClient.php index 18bf8f569bbb..381202de2320 100644 --- a/src/Symfony/Component/HttpClient/NativeHttpClient.php +++ b/src/Symfony/Component/HttpClient/NativeHttpClient.php @@ -193,6 +193,11 @@ public function request(string $method, string $url, array $options = []): Respo $options['timeout'] = min($options['max_duration'], $options['timeout']); } + $bindto = $options['bindto']; + if (!$bindto && (70322 === \PHP_VERSION_ID || 70410 === \PHP_VERSION_ID)) { + $bindto = '0:0'; + } + $context = [ 'http' => [ 'protocol_version' => min($options['http_version'] ?: '1.1', '1.1'), @@ -221,7 +226,7 @@ public function request(string $method, string $url, array $options = []): Respo 'disable_compression' => true, ], static function ($v) { return null !== $v; }), 'socket' => [ - 'bindto' => $options['bindto'] ?: '0:0', + 'bindto' => $bindto, 'tcp_nodelay' => true, ], ];