Skip to content

Upgrading hyper 0.10 to 0.11

Breaking0.10.16 → 0.11.27Breaking31Security1New73Changed14Fixed67Other1

BreakingUpgrade verdict

30 breaking changes and a security fix.

  • The old StatusClass type is gone.
  • Code that treated the Cookie header as a list of strings must now use its get and set methods.
  • HttpDate no longer has public fields; convert between HttpDate and SystemTime as needed.
  • Removes the link_extensions methods of the Link header until fixed.
Top 4 of 31 that need code or config changes
Breaking30
Removes deprecated StatusClass.
StatusClass
The Cookie header is no longer a wrapper over a Vec<String> and must be accessed via its get and set methods.
CookieCookie.get()Cookie.set()
HttpDate no longer has public fields; convert between HttpDate and SystemTime as needed.
HttpDateSystemTime
Removes the link_extensions methods of the Link header until fixed.
Linklink_extensions
Removes several deprecated methods for converting Headers into strings; use more specialized methods instead.
Headers
The Url type is no longer used; Client API instances use hyper::Uri, Error::Uri becomes hyper::error::UriError, and HTTP_VALUE is private.
UrlClienthyper::UriError::Urihyper::error::UriErrorhyper::header::parsing::HTTP_VALUEhttp_percent_encoding
Renames Preference::HandlingLeniant to Preference::HandlingLenient to fix a typo in the variant and its string representation.
PreferencePreference::HandlingLeniantPreference::HandlingLenient
Server is no longer the primary entry point; an Http type is created and then bound to receive a Server or passed to other Tokio things.
ServerHttpbind
The fields of the Host header are no longer available; use the getter methods instead.
Host
Headers.remove() now returns Option<H> instead of bool; use Headers.has() to check if a header exists.
Headers.remove()Headers.has()
Removes the mime! macro, Mime constructor, and TopLevel and SubLevel enums; use constants or parse a string instead.
mime!MimeTopLevelSubLevel
Response.status() now returns a StatusCode by value.
Response.status()StatusCode
Redesigns the API to use Futures and Tokio.
Switches to non-blocking (asynchronous) IO.
Redesigns the RequestUri type into Uri, an opaque struct with getter methods instead of an enum.
RequestUriUri
Any use of Quality(num) should change to q(num).
Qualityq()
The fmt_header method now takes a different formatter; headers implementing fmt::Display can call f.fmt_line(self).
fmt_headerfmt::Displayfmt_line()
The Encoding enum gains an additional variant, Trailers.
EncodingEncoding::Trailers
Origin.scheme and Origin.host now return Options, since Origin could be null.
Origin.schemeOrigin.host
Explicit StatusCode checks such as equality comparisons must use the value instead of a reference.
StatusCode
Request.remote_addr is now an Option<SocketAddr> instead of SocketAddr.
Request.remote_addrOption<SocketAddr>SocketAddr
Adds a new variant to the Encoding enum, which can break exhaustive matches.
Encoding
A big sweeping set of breaking changes.
Header::parse_header now receives &Raw instead of &[Vec<u8>], requiring changes to existing implementations.
Header::parse_headerRaw
LanguageTag moves from the crate root to the hyper::header module.
LanguageTaghyper::header
Removes undocumented from_u16 and makes the status module private; use StatusCode::try_from and hyper::StatusCode.
from_u16StatusCode::try_fromhyper::status::StatusCodehyper::StatusCode
Replaces status.class() usage with the equivalent status.is_*() methods.
status.class()status.is_*()
Using RawStatus now requires enabling the raw_status crate feature.
RawStatusraw_status
Some headers now use unicase::Ascii instead of UniCase; upgrade code to Ascii::new(s).
UniCaseunicase::AsciiAscii::new(s)
Breaks many Client and Server APIs; Handlers are now used for asynchronous events per the documentation.
ClientServerHandlers
Security1
Removes logs that contain request and response data.