This project contains HTTP/2 support for Swift projects using SwiftNIO.
Please be aware that this project is currently in a beta state, and is subject to change. There are a number of current limitations in the project (see the Beta section for more details), and the API remains subject to change.
swift-nio-http2 is a SwiftPM project and can be built and tested very simply:
$ swift build $ swift test
Note, however, that you need nghttp2 installed and available to the linker. On macOS or other Darwin platforms, the easiest way to get nghttp2 is via Homebrew:
$ brew install nghttp2
For more recent Linux systems, nghttp2 may be available from your package manager. Otherwise, you may need to build it from source.
This project is currently in a beta state. The intention is to allow the wider SwiftNIO community to get early access in order to provide feedback and help guide the development of the HTTP/2 support.
The current version of these bindings has a dependency on nghttp2. This dependency is intended to be temporary: it was used to get the functionality up-and-running, but as time goes on nghttp2 should be scaled back, and eventually removed once all the functionality it provides has been replaced with Swift code.
Due to this early state, there are a number of limitations in the current bindings. Please be aware of them. The known limitations are listed below:
- Promises on control frame writes do not work and will be leaked. Promises on DATA frame writes work just fine and will be fulfilled correctly.
- No support for manual flow control window management, only automatic.
- No support for sending priority frames, and received priority frames will not be transmitted on the channel pipeline.
- No support for push promise frames, either sending or receiving.
- No low-level support for managing DATA frame boundaries: DATA frames may be interleaved and merged/split as necessary by nghttp2.
If you choose to use this project, please submit feedback and bug reports when you encounter problems or limitations.
Developing SwiftNIO HTTP/2
For the most part, SwiftNIO development is as straightforward as any other SwiftPM project. With that said, we do have a few processes that are worth understanding before you contribute. For details, please see
CONTRIBUTING.md in this repository.
Help us keep the lights on
0.2.0 - Dec 10, 2018
- Changed around the types used on
- Formally required Swift 4.1, though Swift 4.0 never worked with this repo. (#21)
- Added support for newish nghttp2 versions. (#23)
- Added support for old nghttp2 versions. (#29)
- Laid some groundwork for pure-Swift implementation. (#10, #14)
- Fixed issue where child channels would not be correctly activated. (#27)
- Fixed issue where trailers would fail to be sent. (#25)
- Prevented crashes when the client preamble was invalid. (#12)
- Prevented crashes when SETTINGS_MAX_CONCURRENT_STREAMS was set to be higher than the cache of old streams. (#13)
- Prevented crashes due to discarding active streams instead of invalid ones. (#11)
- Cleaned up submodule checkout. (#20)
- Documentation improvements. (#18)
- Many test improvements (#8, #9, #15)