warp is a breakthrough server web framework for the Rust language.
Today sees the 11th release of warp, v0.1.10! I wanted to show off the new features, and highlight some of the amazing work that has appeared since the initial announcement.
- TLS Support : there is now optional support TLS, enabled via the
- CORS : There is a “wrapping” filter (warp’s idea of middleware) that can provide CORS to any existing
- Retrieving the remote address.
- Websocket test helpers : testing filters has always been easy thanks to
warp::test, and now,
warp::test::wsallows for easy testing of Websocket routes specifically.
In case you missed it, some highlights of work that has landed before v0.1.10:
- Rejection system clarity: warp initially had a rejection system that would try to automatically translate rejections into HTTP responses. It wasn’t that scalable. The rejection system now is simply errors for why a request failed, and
Filter::recovercan be used to translate those into specific HTTP responses.
warp::fsfilters automatically support Conditional and Range requests, and try to use the OS blocksize for improved performance all around.
- Streaming request and response bodies.
- Support for custom transports besides the default TCP.
- And many smaller improvements and new filters.
When I announced warp initially, I had mentioned the
Service trait, and the tower-web framework. There are still plans to see warp and tower-web merge, and current efforts have been around solidifying the
Service trait itself.
As a recap, the
Service trait is essentially some extra pieces on top of an
async fn(Request) -> Response. Our aim is that
Service and the http crate are the most basic interface that the ecosystem can gather behind. Server implementations and frameworks could be compatible with each other, as long they both just knew about
Being the common interface, it then becomes easier for frameworks and users to add in “tower middleware”, since a wrapped
Service is still a
Service. There are already several tower middlewares that have been developed in support of Linkerd2.
We recently published a new release of
tower-service. A prototype now exists for warp to be able to convert a
Filter directly into an HTTP
Service. From there, we could simply run it directly via
hyper::Server. Other HTTP server implementations that supported
Service could theoretically also just run it, and the user would still just deal with
The future of webdev in Rust looks bright!
This is similar to other languages, like WSGI, Rack, Servlet, WAI, and the like. ↩︎