cargo hyper 0.12.0

latest releases: 0.14.17, 0.14.16, 0.14.15...
5 years ago

Features

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 the Payload trait.

    (19f90242)

  • Each payload chunk must implement Buf, instead of
    just AsRef<[u8]>.

    (a3be110a)

  • Replace any references of
    hyper::client::FutureResponse to hyper::client::ResponseFuture.

    (04c74ef5)

  • The Service trait has changed: it has some changed
    associated types, and call is now bound to &mut self.

    The NewService trait has changed: it has some changed associated
    types, and new_service now returns a Future.

    Client no longer implements Service for now.

    hyper::server::conn::Serve now returns Connecting instead of
    Connections, since new_service can now return a Future. The
    Connecting is a future wrapping the new service future, returning
    a Connection afterwards. In many cases, Future::flatten can be
    used.

    (2dc6202f)

  • The Server is no longer created from Http::bind,
    nor is it run. It is a Future that must be polled by an
    Executor.

    The hyper::server::Http type has move to
    hyper::server::conn::Http.

    (c4974500)

  • Client:new(&handle) and Client::configure() are now
    Client::new() and Client::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 Services, inference might be unable to determine
    what error type you mean to return.

    (5d3c4722)

  • All uses of Handle now need to be new-tokio Handle.

    (27b8db3a)

  • Custom connectors should now implement Connect
    directly, instead of Service.

    Calls to connect no longer take Uris, but Destination. There
    are scheme, host, and port 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 a Payload instead.

    hyper::Body can still be used as a Stream.

    Passing a custom impl Stream will need to either implement
    Payload, or as an easier option, switch to Body::wrap_stream.

    Body::pair has been replaced with Body::channel, which returns a
    hyper::body::Sender instead of a futures::sync::mpsc::Sender.

    (fbc449e4)

  • Method, Request, Response, StatusCode,
    Version, and Uri have been replaced with types from the http
    crate.

    (3cd48b45)

    • The variants of Method are now uppercase, for instance, Method::Get is now Method::GET.
    • The variants of StatusCode are now uppercase, for instance, StatusCode::Ok is now StatusCode::OK.
    • The variants of Version are now uppercase, for instance, HttpVersion::Http11 is now Version::HTTP_11.
  • 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 as hyper::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 your Cargo.toml
    as a dependency.

    (3cd48b45)

  • Removed compat cargo feature, and compat related API. This was the conversion methods for hyper's
    types to and from http crate's types.

    (3cd48b45)

  • Removed deprecated APIs:
    (a37e6b59)

    • The server-proto cargo feature, which included impl 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()

Don't miss a new hyper release

NewReleases is sending notifications on new releases.