Skip to content

Commit

Permalink
[HttpClient] Revert bindto workaround
Browse files Browse the repository at this point in the history
… for unaffected PHP versions

Signed-off-by: Alexander M. Turek <me@derrabus.de>
  • Loading branch information
derrabus committed Jun 8, 2021
1 parent d6c0260 commit 534bac2
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion NativeHttpClient.php
Original file line number Diff line number Diff line change
Expand Up @@ -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'),
Expand Down Expand Up @@ -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,
],
];
Expand Down

0 comments on commit 534bac2

Please sign in to comment.