Provides a low-level implementation of the HTTP/2 protocol.
Please see the project documentation for more details.
- Getting Started - This guide explains how to use the
protocol-http2gem to implement a basic HTTP/2 client.
Please see the project releases for all releases.
- Sign releases with the Socketry release certificate.
- Decode and discard
HEADERSreceived for a locally-initiated stream which was already reset, e.g. a response in flight when the request was cancelled, rather than failing the connection withProtocolError. This keeps the HPACK decoder state synchronized with the remote peer (RFC 9113 §5.1). CONTINUATIONframes generated when packing a large header block now carry the stream ID of the frame they continue.
- Treat
RST_STREAM(NO_ERROR)as an orderly stream closure rather than constructing aStreamError.
- On a graceful
GOAWAY(error code0), keep the connection open until the streams the remote peer accepted have completed, instead of closing it immediately and failing those requests withEOFError. Connection#create_streamrefuses to open a locally-initiated stream once aGOAWAYhas been received, as required by RFC 9113 §6.8.
- Ignore the reserved high bit when decoding GOAWAY last stream IDs.
- Improve
StreamErrormessages for HTTP/2 stream reset error codes.
- On RST_STREAM with REFUSED_STREAM, close the stream with
Protocol::HTTP::RefusedErrorinstead ofStreamError.
- On GOAWAY, proactively close unprocessed streams (ID above
last_stream_id) withProtocol::HTTP::RequestRefusedError, enabling safe retry of non-idempotent requests.
- When closing a connection with active streams, if an error is not provided, it will default to
EOFErrorso that streams propagate the closure correctly.
- Introduce a limit to the number of CONTINUATION frames that can be read to prevent resource exhaustion. The default limit is 8 continuation frames, which means a total of 9 frames (1 initial + 8 continuation). This limit can be adjusted by passing a different value to the
limitparameter in theContinued.readmethod. Setting the limit to 0 will only read the initial frame without any continuation frames. In order to change the default, you can redefine theLIMITconstant in theProtocol::HTTP2::Continuedmodule, OR you can pass a different frame class to the framer.
- Async::HTTP - A high-level HTTP client and server implementation.
We welcome contributions to this project.
- Fork the repository.
- Create your feature branch (
git checkout -b my-new-feature). - Commit your changes (
git commit -am 'Add some feature.'). - Push to the branch (
git push origin my-new-feature). - Create a new pull request.
To run the test suite:
$ bundle exec susTo prepare a release branch and open a pull request from an up-to-date main:
$ bundle exec bake gem:github:release:patch # or minor or majorSee bake-gem-github for setup, remote releases, and recovery.
In order to protect users of this project, we require all contributors to comply with the Developer Certificate of Origin. This ensures that all contributions are properly licensed and attributed.
This project is best served by a collaborative and respectful environment. Treat each other professionally, respect differing viewpoints, and engage constructively. Harassment, discrimination, or harmful behavior is not tolerated. Communicate clearly, listen actively, and support one another. If any issues arise, please inform the project maintainers.