- Features:
- Add
pong
constructor to websocket messages. - Add
redirect::see_other
andredirect::permanent
helpers.
- Add
- Fixes:
- Fix
fs
filters sometimes having an off-by-one error with range requests. - Fix CORS to allow spaces when checking
Access-Control-Request-Headers
.
- Fix
- Features:
- Add TLS client authentication support.
- Add TLS OCSP stapling support.
- Add
From<Reject>
forRejection
. - Add
close_frame
accessor tows::Message
.
- Changes:
- Update to Tokio v1.
- Update to Bytes v1.
- Update to hyper v0.14.
- Rework
sse
filter to be more likews
, with a singleEvent
type and builder. - Change
cookie
filter to extract a genericFromStr
value.
- Features:
- Add
wrap_fn
, which can be used to create aWrap
from a closure. These in turn are used withFilter::with()
. - Add
warp::host
filters to deal withHost
/:authority
headers. - Relax some lifetime bounds on
Server
.
- Add
- Fixes:
- Fix panic when URI doesn't have a slash (for example,
CONNECT foo.bar
).
- Fix panic when URI doesn't have a slash (for example,
- Features:
- Add
tracing
internals in place oflog
(log is still emitted for backwards compatibility). - Add
warp::trace
module set of filters to customizetracing
dianostics. - Add
path
method towarp::fs::File
reply. - Add
source
implementation forBodyDeserializeError
. - Make
warp::ws::MissingConnectionUpgrade
rejection public.
- Add
- Features:
- Add
warp::compression
filters, which will compress response bodies. - Add
warp::header::value()
filter to get a requestHeaderValue
. - Add
request_headers
method towarp::log::Info
. - Add
max_frame_size
towarp::ws::Ws
builder. - Add
remote_addr
towarp::test::RequestBuilder
. - Add
try_bind_with_graceful_shutdown
towarp::Server
builder. - Add
serve_incoming_with_graceful_shutdown
towarp::Server
builder.
- Add
- Fixes:
- Fix
warp::addr::remote
when used withServer::tls
. - Fix panic in
warp::path::{peek, tail, full}
filters when the request URI is in authority-form or asterisk-form.
- Fix
- Features:
- Implement
Reply
for allBox<T>
whereT: Reply
. - Add
name
methods toMissingHeader
,InvalidHeader
, andMissingCookie
rejections. - Add
warp::ext::optional()
filter that optionally retrieves an extension from the request.
- Implement
- Fixes:
- Fix the sending of pings when a user sends a
ws::Message::ping()
.
- Fix the sending of pings when a user sends a
- Features:
- Add
close
andclose_with
constructors towarp::ws::Message
.
- Add
- Fixes:
- Fix
warp::fs
filters using a very small read buffer.
- Fix
- Features:
- Update to
std::future
, addingasync
/await
support! - Add
warp::service()
to convert aFilter
into atower::Service
. - Implement
Reply
forBox<dyn Reply>
.
- Update to
- Changes:
- Refactored Rejection system (#311).
- Change
path!
macro to assume apath::end()
by default, with explicit/ ..
to allow building a prefix (#359). - Change
warp::path(str)
to accept anyAsRef<str>
argument. - Rename "2"-suffixed filters and types (
get2
toget
,ws2
tows
, etc). Filter::{or, or_else, recover}
now requireSelf::Error=Rejection
. This helps catch filters that didn't make sense (likewarp::any().or(warp::get())
).- Change several
warp::body
filters (#345). - Change
warp::cors()
to return awarp::cors::Builder
which still implementsWrap
, but can alsobuild
a cheaper-to-clone wrapper. - Change
warp::multipart
stream API to allow for errors when streaming. - Change
warp::sse
to no longer return aFilter
, addswarp::sse::reply
to do whatSse::reply
did. - Change
Server::tls()
to return a TLS server builder (#340). - Change internal
warp::never::Never
usage withstd::convert::Infallible
. - Remove
warp::ext::set()
function (#222). - Remove deprecated
warp::cookie::optional_value()
.
- Features:
- Implement
Clone
for thewarp::cors
filter. - Add
into_bytes
method forwarp::ws::Message
.
- Implement
- Features:
- Make
warp::multipart
andwrap::ws
support optional, though enabled by default.
- Make
- Fixes:
- Fix
warp::fs::dir
filter to reject paths containing backslashes.
- Fix
- Features:
- Add
warp::multipart
support.
- Add
- Features:
- Export all built-in Rejection causes in the
warp::reject
module. - Add
Server::try_bind
as fallible bind methods.
- Export all built-in Rejection causes in the
- Features:
- Unseal the
Reply
trait: custom types can now implementReply
. - Add
warp::sse::keep_alive()
replacement forwarp::sse::keep()
which allows customizing keep-alive behavior. - Add
warp::log::Info::host()
accessor.
- Unseal the
- Fixes:
- Fix
warp::fs
filters from sending some headers for304
responses.
- Fix
- Features:
- Add more accessors to
warp::log::Info
type for building custom log formats. - Implement
Reply
forCow<'static, str>
.
- Add more accessors to
- Features:
- Add
warp::header::optional
filter.
- Add
- Features:
- Implement
Reply
forVec<u8>
and&'static [u8]
. - Set
content-type
header automatically for string and bytes replies. - Add
expose_headers
towarp::cors
filter.
- Implement
- Features:
- Implement
PartialEq
,Eq
, andClone
forwarp::ws::Message
.
- Implement
- Fixes:
- Fix panic when incoming request URI may not have a path (such as
CONNECT
requests).
- Fix panic when incoming request URI may not have a path (such as
- Features:
- Add
warp::sse
filters for handling Server-Sent-Events. - Add
allow_headers
towarp::cors
filter.
- Add
- Fixes:
- Fix TLS handshake to close the connection if handshake fails.
- Features:
- Add optional TLS support. Enable the
tls
feature, and then useServer::tls
. - Add
warp::cors
filter for CORS support. - Add
warp::addr::remote
to access the remote address of a request. - Add
warp::log::custom
to support customizing of access logging. - Add
warp::test::ws
to improve testing Websocket filters.
- Add optional TLS support. Enable the
- Features:
- Add
warp::ext::get
andwarp::ext::set
to set request extensions. - Add
Filter::untuple_one
to unroll nested tuple layers from extractions. - Add
Ws2::max_send_queue
configuration method. - Add
ws::Message::is_ping
method, and yield pings to user code.
- Add
- Fixes:
- Fix panic in debug mode when receiving a websocket ping.
- Features:
-
Improved flexibility of
Rejection
system.The
Rejection
type can now nest and combine arbitrary rejections, so it is no longer bound to a small set of meanings. The ranking of status codes is still used to determine which rejection gets priority.A different priority can be implemented by handling rejections with a
Filter::recover
, and searching for causes in order viaRejection::find_cause
.- Adds
warp::reject::custom()
to create aRejection
with anyInto<Box<std::error::Error>>
. These rejections should be handled with an eventualFilter::recover
. Any unhandled custom rejections are considered a server error. - Deprecates
Rejection::with
. Use custom rejections instead. - Deprecates
Rejection::into_cause
, as it can no longer work. Always returnsErr(Rejection)
. - Deprecates
Rejection::json
, since the format needed is too generic. Theerrors.rs
example shows how to send custom JSON when recovering from rejections. - Deprecates
warp::reject()
, since it current signals a400 Bad Request
, but in newer versions, it will signal404 Not Found
. It's deprecated simply to warn that the semantics are changing, but the function won't actually go away. - Deprecates
reject::bad_request()
,reject::forbidden()
, andreject::server_error()
. Uses custom rejections instead.
- Adds
-
Renamed
warp::path::index
towarp::path::end
.
-
-
Features:
- Export the types returned from the
warp::body::stream()
filter,BodyStream
andStreamBuf
. - Deprecated
Rejection::into_cause
, since an upcoming Rejection refactor will make it impossible to support.
- Export the types returned from the
-
Fixes:
- Fix websocket filters to do a case-insensitive match of the
Connection
header.
- Fix websocket filters to do a case-insensitive match of the
- Features:
- Add Conditional and Range request support for
warp::fs
filters. - Relaxed bounds on
Rejection::with
to no longer need to beSized
. - Add
warp::path::peek()
which gets the unmatched tail without adjusting the currently matched path.
- Add Conditional and Range request support for
-
Features:
- Serve
index.html
automatically withwarp::fs::dir
filter. - Include
last-modified
header withwarp::fs
filters. - Add
warp::redirect
to easily reply with redirections. - Add
warp::reply::{with_status, with_header}
to wrapimpl Reply
s directly with a new status code or header. - Add support for running a warp
Server
with a custom source of incoming connections.Server::run_incoming
to have the runtime started automatically.Server::serve_incoming
to get a future to run on existing runtime.- These can be used to support Unix Domain Sockets, TLS, and other transports.
- Add
Rejection::into_cause()
to retrieve the original error of a rejection back. - Add
Rejection::json()
to convert a rejection into a JSON response.
- Serve
-
Fixes
- Internal errors in warp that result in rendering a
500 Internal Server Error
are now also logged at theerror
level.
- Internal errors in warp that result in rendering a
- Features:
- Add
warp::reply::with::headers(HeaderMap)
filter wrapper. - Add
warp::cookie::optional()
to get an optional cookie value. - Add
warp::path::full()
to be able to extract the full request path without affecting route matching. - Add graceful shutdown support to the
Server
. - Allow empty query strings to be treated as for
warp::query()
.
- Add
- Features:
- Add
warp::reject::forbidden()
to represent403 Forbidden
responses. - Add
Rejection::with(cause)
to customize rejection messages.
- Add
- Fixes:
- Fix
warp::body::form
to allow charsets in thecontent-type
header.
- Fix
- Features:
- Implemented
Reply
forResponse<impl Into<hyper::Body>
, allowing streaming response bodies. - Add
warp::body::stream()
filter to access the request body as animpl Stream
. - Add
warp::ws2()
as a more flexible websocket filter.- This allows passing other extracted values to the upgrade callback, such as a value from a header or path.
- Deprecates
warp::ws()
, andws2()
will becomews()
in 0.2.
- Add
warp::get2()
,warp::post2()
,warp::put2()
, andwarp::delete2()
as more standard method filters that are used via chaining instead of nesting.get()
,post()
,put()
, anddelete()
are deprecated, and the new versions will become them in 0.2.
- Add
Filter::unify()
for when a filter returnsEither<T, T>
, converting theEither
into the innerT
, regardless of which variant it was.-
This requires that both sides of the
Either
be the same type. -
This can be useful when extracting a value that might be present in different places of the request.
// Allow `MyId` to be a path parameter or a header... let id = warp::path::param::<MyId>() .or(warp::header::<MyId>()) .unify(); // A way of providing default values... let dnt = warp::header::<bool>("dnt") .or(warp::any().map(|| true)) .unify();
-
- Add
content-type
header automatically to replies fromfile
anddir
filters based on file extension. - Add
warp::head()
,warp::options()
, andwarp::patch()
as new Method filters. - Try to use OS blocksize in
warp::fs
filters.
- Implemented
- Fixes:
- Chaining filters that try to consume the request body will log that the body is already consumed, and return a
500 Internal Server Error
rejection.
- Chaining filters that try to consume the request body will log that the body is already consumed, and return a
- Features:
- Add
warp::query::raw()
filter to get query as aString
. - Add
Filter::recover()
to ease customizing of rejected responses. - Add
warp::header::headers_clone()
filter to get a clone of request'sHeaderMap
. - Add
warp::path::tail()
filter to get remaining "tail" of the request path.
- Add
- Fixes:
- URL decode path segments in
warp::fs
filters.
- URL decode path segments in
- Intial release.