Request and Response are now visible from:
- hyper::{Request, Response}
- hyper::server::{Request, Response}
- hyper::client::{Request, Response}
They truly exist in the http module, but are re-exported to reduce the number of breaking changes.
request::new and response::new were renamed to ::from_wire to reduce confusion with Request::new
and Response::new. See issue #1126
Request now has an optional Body, because not all requests have bodies.
Use body_ref() to determine if a body exists.
Use body() to take the body, or construct one if no body exists.
Closes#1155
BREAKING CHANGE: Response::body() now consumes the response
This allows servers to check if an incoming URI is in absolute form.
Especially useful for proxies to determine if the request was meant to
be proxied or aimed directly at the proxy server.
In the spirit of Postel's law, ignore invalid cookies rather than
completely discard the entire Cookie header, which is what the current
code does, and which will lead to confusion when dealing with headers
with invalid cookies injected by proxies and intermediate apps servers.
* Move to the Trusty distro, since Precise is nearing end of life this year
(https://blog.travis-ci.com/2017-04-17-precise-EOL)
* Add a --verify flag to avoid kcov segfaults.
This was the reason why a 0% coverage was reported
* Link dead code to get more pessimistic results
The `Cookie` header now has 'set' and `get` methods, to treat the list of
cookies as a map.
Closes#1145
BREAKING CHANGE: The `Cookie` header is no longer a wrapper over a
`Vec<String>`. It must be accessed via its `get` and `append` methods.
This makes the `u16` in `Quality` private, since it only has a valid
range of 0-1000, and can't be enforced in public. The `q` function now
allows both `f32`s and `u16`s to construct a `Quality`.
BREAKING CHANGE: Any use of `Quality(num)` should change to `q(num)`.
This removes the need for someone to use the `time` crate to create a
date compatible with HTTP headers. It now works with the `SystemTime`
type from the standard library.
BREAKING CHANGE: `HttpDate` no longer has public fields. Convert between
`HttpDate` and `SystemTime` as needed.
They can be re-added later, removing now prevents that fix from being a
breaking change.
BREAKING CHANGE: The `link_extensions` methods of the `Link` header are
removed until fixed.
This will make the `HttpConnector` require the `scheme` to be `http`,
and return an error otherwise. This value is enabled by default, so any
requests to URLs that aren't of scheme `http` will now see an error
message stating the failure.
When constructing a connector that wraps an `HttpConnector`, this
enforcement can be disabled to allow connecting over TCP easily even
when the scheme is not `http`. To do, call
`connector.enforce_http(false)`.
The `header::Formatter` ensures that a formatted header is written to a
line, and allows for headers that require multiple lines. The only
header to specifically require this is `Set-Cookie`.
BREAKING CHANGE: The `fmt_header` method has changed to take a different
formatter. In most cases, if your header also implements
`fmt::Display`, you can just call `f.fmt_line(self)`.
The `TE` header is used by a client to specify which
transfer encodings other than `chunked` it will accept.
It also specifies whether HTTP trailers are acceptable.
This commit also adds a `Trailers` variant to the
`hyper::header::shared::Encoding` enum.
Closes#1109
BREAKING CHANGE: The `Encoding` enum has an additional
variant, `Trailers`.