Enable HTTP keep-alive by default for HTTP client #495
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This changeset enables HTTP keep-alive by default for the HTTP client. HTTP keep-alive (reusing persistent connections) offers significant performance improvements when sending many requests to the same host as it avoids recreating the underlying TCP/IP connection and repeating the TLS handshake for secure HTTPS requests.
HTTP keep-alive is now enabled by default. If you do not want to use HTTP keep-alive, you can disable this feature by sending a
Connection: close
HTTP request header or by using HTTP/1.0 like this:We've done some careful testing in PR #486 and our sophisticated test suite that covers tests against both well-behaving and misbehaving HTTP servers that might occur in the wild. On top of this, we've done some extensive tests in real-world applications in the past weeks after merging this feature. The test suite confirms this has 100% code coverage and does not otherwise affect our public APIs. If you encounter any issues with this in the wild, please confirm by disabling HTTP keep-alive and report a bug ticket in this case. If you'd like to support this development, consider sponsoring ReactPHP! ❤️
Builds on top of #486, #484 and others
Refs #488, #468 and others