Merged
Merged
Conversation
andig
mentioned this pull request
Closed
| if (strpos($path, '://') === false) { | ||
| $path = 'unix://' . $path; | ||
| } elseif (substr($path, 0, 7) !== 'unix://') { | ||
| throw new \InvalidArgumentException('Given URI "' . $path . '" is InvalidArgumentException'); |
| To listen on a Unix domain socket, the uri MUST be prefixed with the `unix://` scheme: | ||
|
|
||
| ```php | ||
| $server = new Server('unix:///tmp/.sock', $loop); |
| } | ||
|
|
||
| /** | ||
| * @covers React\EventLoop\StreamSelectLoop::tick |
| } | ||
|
|
||
| /** | ||
| * @covers React\EventLoop\StreamSelectLoop::tick |
|
|
||
| private function getRandomSocketUri() | ||
| { | ||
| return "unix://" . sys_get_temp_dir() . DIRECTORY_SEPARATOR . uniqid(rand(), true) . '.sock'; |
|
|
||
| if (strlen($path) > 104) { | ||
| return Promise\reject(new InvalidArgumentException('Given URI "' . $path . '" exceeds maximum allowed length of 104 bytes')); | ||
| $maxLen = PHP_OS === 'Darwin' ? 104 : 108; |
| // string > 104 characters | ||
| $path = "unix://" . sys_get_temp_dir() . DIRECTORY_SEPARATOR . str_repeat('_', 100) . '.sock'; | ||
| // string > 104/108 characters | ||
| $path = "unix://" . sys_get_temp_dir() . DIRECTORY_SEPARATOR . str_repeat('_', 104) . '.sock'; |
|
|
||
| public function testConnectWithOverlyLongAddress() | ||
| { | ||
| https://serverfault.com/questions/641347/check-if-a-path-exceeds-maximum-for-unix-domain-socket |
clue
mentioned this pull request
Closed
| $server = new SecureServer($server, $loop, $context['tls']); | ||
| if ($scheme === 'tls') { | ||
| $server = new SecureServer($server, $loop, $context['tls']); | ||
| } |
|
|
||
| $maxLen = PHP_OS === 'Darwin' ? 104 : 108; | ||
| if (strlen($path) > $maxLen) { | ||
| return Promise\reject(new InvalidArgumentException('Given URI "' . $path . '" exceeds maximum allowed length')); |
clue approved these changes Nov 13, 2017
clue
changed the title
Add unix server
Support Unix domain socket (UDS) server
jsor approved these changes Nov 16, 2017