[HttpClient] Revert bindto workaround

… for unaffected PHP versions

Signed-off-by: Alexander M. Turek <me@derrabus.de>
This commit is contained in:
Alexander M. Turek 2021-06-08 18:37:25 +02:00
parent 7ca099579c
commit e9afce3334

View File

@ -193,6 +193,11 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
$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 @@ final class NativeHttpClient implements HttpClientInterface, LoggerAwareInterfac
'disable_compression' => true,
], static function ($v) { return null !== $v; }),
'socket' => [
'bindto' => $options['bindto'] ?: '0:0',
'bindto' => $bindto,
'tcp_nodelay' => true,
],
];