Provides abstractions for working with the HTTP protocol.
- General abstractions for HTTP requests and responses.
- Symmetrical interfaces for client and server.
- Light-weight middleware model for building applications.
Please see the project documentation for more details.
-
Getting Started - This guide explains how to use
protocol-httpfor building abstract HTTP interfaces. -
Message Body - This guide explains how to work with HTTP request and response message bodies using
Protocol::HTTP::Bodyclasses. -
Headers - This guide explains how to work with HTTP headers using
protocol-http. -
Middleware - This guide explains how to build and use HTTP middleware with
Protocol::HTTP::Middleware. -
Streaming - This guide gives an overview of how to implement streaming requests and responses.
-
Design Overview - This guide explains the high level design of
protocol-httpin the context of wider design patterns that can be used to implement HTTP clients and servers.
Please see the project releases for all releases.
- Breaking: Move
Protocol::HTTP::Header::QuotedStringtoProtocol::HTTP::QuotedStringfor better reusability. - Breaking: Handle cookie key/value pairs using
QuotedStringas per RFC 6265.- Don't use URL encoding for cookie key/value.
- Breaking: Remove
Protocol::HTTP::URLandProtocol::HTTP::Reference– replaced byProtocol::URLgem.Protocol::HTTP::URL->Protocol::URL::Encoding.Protocol::HTTP::Reference->Protocol::URL::Reference.
- Introduce rich support for
Header::Digest,Header::ServerTiming,Header::TE,Header::TrailerandHeader::TransferEncoding. - Improved HTTP Trailer Security
- Improve consistency of Body
#inspect. - Improve
as_jsonsupport for Body wrappers.
- Add
Protocol::HTTP::Headers#to_amethod that returns the fields array, providing compatibility with standard Ruby array conversion pattern. - Expose
tailinHeaders.newso that trailers can be accurately reproduced. - Add agent context.
Protocol::HTTP::Headersnow raise aDuplicateHeaderErrorwhen a duplicate singleton header (e.g.content-length) is added.Protocol::HTTP::Headers#addnow coerces the value to a string when adding a header, ensuring consistent behaviour.Protocol::HTTP::Body::Head.fornow accepts an optionallengthparameter, allowing it to create a head body even when the body is not provided, based on the known content length.
- Drop support for Ruby v3.1.
- Add support for parsing
accept,accept-charset,accept-encodingandaccept-languageheaders into structured values.
- Add support for
priority:header.
- Clarify behaviour of streaming bodies and copy
Protocol::Rack::Body::StreamingtoProtocol::HTTP::Body::Streamable. - Copy
Async::HTTP::Body::WritabletoProtocol::HTTP::Body::Writable.
- Ensure chunks are flushed if required, when streaming.
- protocol-http1 — HTTP/1 client/server implementation using this interface.
- protocol-http2 — HTTP/2 client/server implementation using this interface.
- protocol-url — URL parsing and manipulation library.
- async-http — Asynchronous HTTP client and server, supporting multiple HTTP protocols & TLS.
- async-websocket — Asynchronous client and server WebSockets.
We welcome contributions to this project.
- Fork it.
- 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 new Pull Request.
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.