Upgrading hyper 0.10 to 0.11
Breaking0.10.16 → 0.11.27Breaking31Security1New73Changed14Fixed67Other1
BreakingUpgrade verdict
30 breaking changes and a security fix.
In plain terms
- 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.
Must act Top 4 of 31 that need code or config changes
What you must change
Breaking30
Removes deprecated StatusClass.
StatusClassThe 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.
HttpDateSystemTimeRemoves the link_extensions methods of the Link header until fixed.
Linklink_extensionsRemoves several deprecated methods for converting Headers into strings; use more specialized methods instead.
HeadersThe 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_encodingRenames Preference::HandlingLeniant to Preference::HandlingLenient to fix a typo in the variant and its string representation.
PreferencePreference::HandlingLeniantPreference::HandlingLenientServer 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.
ServerHttpbindThe fields of the Host header are no longer available; use the getter methods instead.
HostHeaders.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!MimeTopLevelSubLevelResponse.status() now returns a StatusCode by value.
Response.status()StatusCodeRedesigns 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.
RequestUriUriAny 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::TrailersOrigin.scheme and Origin.host now return Options, since Origin could be null.
Origin.schemeOrigin.hostExplicit StatusCode checks such as equality comparisons must use the value instead of a reference.
StatusCodeRequest.remote_addr is now an Option<SocketAddr> instead of SocketAddr.
Request.remote_addrOption<SocketAddr>SocketAddrAdds a new variant to the Encoding enum, which can break exhaustive matches.
EncodingA big sweeping set of breaking changes.
Header::parse_header now receives &Raw instead of &[Vec<u8>], requiring changes to existing implementations.
Header::parse_headerRawLanguageTag moves from the crate root to the hyper::header module.
LanguageTaghyper::headerRemoves undocumented from_u16 and makes the status module private; use StatusCode::try_from and hyper::StatusCode.
from_u16StatusCode::try_fromhyper::status::StatusCodehyper::StatusCodeReplaces status.class() usage with the equivalent status.is_*() methods.
status.class()status.is_*()Using RawStatus now requires enabling the raw_status crate feature.
RawStatusraw_statusSome 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.
ClientServerHandlersSecurity1
Removes logs that contain request and response data.