Features
- lib:
- body:
- client:
- rename
FutureResponse
toResponseFuture
(04c74ef5) - support local bind for
HttpConnector
(b6a3c85d, closes #1498) - add support for title case header names (#1497) (a02fec8c, closes #1492)
- add support to set
SO_NODELAY
on client HTTP sockets (016d79ed, closes #1473) - improve construction of
Client
s (fe1578ac) - redesign the
Connect
trait (8c52c2df, closes #1428)
- rename
- error: revamp
hyper::Error
type (5d3c4722, closes #1128, #1130, #1431, #1338) - rt: make tokio runtime optional (d127201e)
- server:
- service: introduce hyper-specific
Service
(2dc6202f, closes #1461)
Bug Fixes
- lib: remove deprecated tokio-proto APIs (a37e6b59)
- server: panic on max_buf_size too small (aac250f2)
Breaking Changes
-
Body::is_empty()
is gone. Replace with
Body::is_end_stream()
, from thePayload
trait.(19f90242)
-
Each payload chunk must implement
Buf
, instead of
justAsRef<[u8]>
.(a3be110a)
-
Replace any references of
hyper::client::FutureResponse
tohyper::client::ResponseFuture
.(04c74ef5)
-
The
Service
trait has changed: it has some changed
associated types, andcall
is now bound to&mut self
.The
NewService
trait has changed: it has some changed associated
types, andnew_service
now returns aFuture
.Client
no longer implementsService
for now.hyper::server::conn::Serve
now returnsConnecting
instead of
Connection
s, sincenew_service
can now return aFuture
. The
Connecting
is a future wrapping the new service future, returning
aConnection
afterwards. In many cases,Future::flatten
can be
used.(2dc6202f)
-
The
Server
is no longer created fromHttp::bind
,
nor is itrun
. It is aFuture
that must be polled by an
Executor
.The
hyper::server::Http
type has move to
hyper::server::conn::Http
.(c4974500)
-
Client:new(&handle)
andClient::configure()
are now
Client::new()
andClient::builder()
.(fe1578ac)
-
Error
is no longer an enum to pattern match over, or
to construct. Code will need to be updated accordingly.For body streams or
Service
s, inference might be unable to determine
what error type you mean to return.(5d3c4722)
-
All uses of
Handle
now need to be new-tokioHandle
.(27b8db3a)
-
Custom connectors should now implement
Connect
directly, instead ofService
.Calls to
connect
no longer takeUri
s, butDestination
. There
arescheme
,host
, andport
methods to query relevant
information.The returned future must be a tuple of the transport and
Connected
.
If no relevant extra information is needed, simply return
Connected::new()
.(8c52c2df)
-
All code that was generic over the body as
Stream
must
be adjusted to use aPayload
instead.hyper::Body
can still be used as aStream
.Passing a custom
impl Stream
will need to either implement
Payload
, or as an easier option, switch toBody::wrap_stream
.Body::pair
has been replaced withBody::channel
, which returns a
hyper::body::Sender
instead of afutures::sync::mpsc::Sender
.(fbc449e4)
-
Method
,Request
,Response
,StatusCode
,
Version
, andUri
have been replaced with types from thehttp
crate.(3cd48b45)
- The variants of
Method
are now uppercase, for instance,Method::Get
is nowMethod::GET
. - The variants of
StatusCode
are now uppercase, for instance,StatusCode::Ok
is nowStatusCode::OK
. - The variants of
Version
are now uppercase, for instance,HttpVersion::Http11
is nowVersion::HTTP_11
.
- The variants of
-
The typed headers from
hyper::header
are gone for now.
The http::header
module is re-exported as hyper::header
.
For example, a before setting the content-length:
use hyper::header::ContentLength;
res.headers_mut().set(ContentLength(15));
And now after, with the http
types:
use hyper::header::{CONTENT_LENGTH, HeaderValue};
res.headers_mut().insert(CONTENT_LENGTH, HeaderValue::from_static("15"));
(3cd48b45)
-
The
mime
crate is no longer re-exported ashyper::mime
.The typed headers don't exist, and so they do not need the
mime
crate.To continue using
mime
for other purposes, add it directly to yourCargo.toml
as a dependency.(3cd48b45)
-
Removed
compat
cargo feature, andcompat
related API. This was the conversion methods for hyper's
types to and fromhttp
crate's types.(3cd48b45)
-
Removed deprecated APIs:
(a37e6b59)- The
server-proto
cargo feature, which includedimpl ServerProto for Http
, and related associated types. client::Config::no_proto()
tokio_proto::streaming::Body::from(hyper::Body)
hyper::Body::from(tokio_proto::streaming::Body)
hyper::Body::from(futures::sync::mpsc::Receiver)
Http::no_proto()
- The