diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a5da4a6..ad62a33a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,49 @@ # Changelog +## 1.10.0 (2021-09-13) + +* Feature: Support listening on existing file descriptors (FDs) with `SocketServer`. + (#269 by @clue) + + ```php + $socket = new React\Socket\SocketSever('php://fd/3'); + ``` + + This is particularly useful when using + [systemd socket activation](https://www.freedesktop.org/software/systemd/man/systemd.socket.html) + like this: + + ```bash + $ systemd-socket-activate -l 8000 php examples/03-http-server.php php://fd/3 + ``` + +* Feature: Improve error messages for failed connection attempts with `errno` and `errstr`. + (#265, #266, #267, #270 and #271 by @clue and #268 by @SimonFrings) + + All error messages now always include the appropriate `errno` and `errstr` to + give more details about the error reason when available. Along with these + error details exposed by the underlying system functions, it will also + include the appropriate error constant name (such as `ECONNREFUSED`) when + available. Accordingly, failed TCP/IP connections will now report the actual + underlying error condition instead of a generic "Connection refused" error. + Higher-level error messages will now consistently report the connection URI + scheme and hostname used in all error messages. + + For most common use cases this means that simply reporting the `Exception` + message should give the most relevant details for any connection issues: + + ```php + $connector = new React\Socket\Connector(); + $connector->connect($uri)->then(function (React\Socket\ConnectionInterface $conn) { + // … + }, function (Exception $e) { + echo 'Error:' . $e->getMessage() . PHP_EOL; + }); + ``` + +* Improve test suite, test against PHP 8.1 release. + (#274 by @SimonFrings) + ## 1.9.0 (2021-08-03) * Feature: Add new `SocketServer` and deprecate `Server` to avoid class name collisions. diff --git a/README.md b/README.md index 3b52482b..9b3131f2 100644 --- a/README.md +++ b/README.md @@ -1486,23 +1486,23 @@ $promise = $connector->connect('localhost:80'); ## Install -The recommended way to install this library is [through Composer](https://getcomposer.org). +The recommended way to install this library is [through Composer](https://getcomposer.org/). [New to Composer?](https://getcomposer.org/doc/00-intro.md) This project follows [SemVer](https://semver.org/). This will install the latest supported version: ```bash -$ composer require react/socket:^1.9 +$ composer require react/socket:^1.10 ``` See also the [CHANGELOG](CHANGELOG.md) for details about version upgrades. This project aims to run on any platform and thus does not require any PHP extensions and supports running on legacy PHP 5.3 through current PHP 8+ and HHVM. -It's *highly recommended to use PHP 7+* for this project, partly due to its vast -performance improvements and partly because legacy PHP versions require several -workarounds as described below. +It's *highly recommended to use the latest supported PHP version* for this project, +partly due to its vast performance improvements and partly because legacy PHP +versions require several workarounds as described below. Secure TLS connections received some major upgrades starting with PHP 5.6, with the defaults now being more secure, while older versions required explicit @@ -1538,7 +1538,7 @@ on affected versions. ## Tests To run the test suite, you first need to clone this repo and then install all -dependencies [through Composer](https://getcomposer.org): +dependencies [through Composer](https://getcomposer.org/): ```bash $ composer install @@ -1547,7 +1547,7 @@ $ composer install To run the test suite, go to the project root and run: ```bash -$ php vendor/bin/phpunit +$ vendor/bin/phpunit ``` The test suite also contains a number of functional integration tests that rely @@ -1555,7 +1555,7 @@ on a stable internet connection. If you do not want to run these, they can simply be skipped like this: ```bash -$ php vendor/bin/phpunit --exclude-group internet +$ vendor/bin/phpunit --exclude-group internet ``` ## License