Commit Graph

401 Commits

Author SHA1 Message Date
Guillaume Gomez
e330d30964 docs(lib): fix rustdoc warnings 2017-11-10 10:22:33 -08:00
Sean McArthur
7b2a2050b7 Merge pull request #1370 from srijs/feat/byte-range-spec-satisfiable
feat(header): implement ByteRangeSpec::to_satisfiable_range
2017-11-06 18:09:26 -08:00
Sean McArthur
19caf54edd chore(lib): fix nightly unused warning about AsciiExt 2017-11-06 17:58:12 -08:00
Sam Rijs
bb54e36c90 feat(header): implement ByteRangeSpec::to_satisfiable_range 2017-11-06 19:53:16 +11:00
Julian Tescher
5700ad79a3 docs(changelog,header,proto,client): Fix small typos 2017-10-21 20:07:56 -07:00
nabijaczleweli
d48ab9601b docs(headers): fix >-quote formatting
'>'s as non-first characters are just '>'s (rustfmt probably broke the
line)
2017-10-15 15:00:49 +02:00
Sean McArthur
9c80fdbb9e refactor(lib): rename http_types to http 2017-09-29 18:12:55 -07:00
Sean McArthur
5027435791 refactor(lib): rename internal http module to proto 2017-09-28 18:28:44 -07:00
Sam Rijs
0c7d375ba3 feat(lib): implement compatibility with http crate 2017-09-22 12:07:57 -07:00
Laurent Arnoud
92595e84a2 feat(header): add ContentType::xml() constructor 2017-09-22 11:27:10 -07:00
Sean McArthur
207fca63ce fix(lib): remove logs that contain request and response data
Closes #1281
2017-08-15 16:04:56 -07:00
Sean McArthur
2ea125e609 chore(lib): fix new unused_mut warnings in nightly 2017-08-11 15:07:49 -07:00
Sean McArthur
f2db365613 Merge pull request #1279 from jethrogb/patch-2
docs(headers): clarify Basic auth
2017-07-31 11:02:39 -07:00
Sean McArthur
a9004958dd chore(header): fix unused doc comment warning in Origin 2017-07-31 09:51:52 -07:00
jethrogb
fcbad58924 docs(headers): clarify Basic auth
See https://tools.ietf.org/html/rfc7617
2017-07-31 09:05:05 -07:00
Sean McArthur
4bd9746a0f fix(header): fix panic from headers.remove when typed doesn't match 2017-07-24 15:22:58 -07:00
Brendan Zabarauskas
c9f4ff3382 feat(headers): export missing header types 2017-07-14 21:05:28 +10:00
Brendan Zabarauskas
2a49cee7b2 chore(headers): Sort header imports alphabetically
This should make it easier to see missing imports in the future
2017-07-14 21:05:28 +10:00
Daiki Mizukami
dc2c6f1a98 refactor(header): remove GetType trait
Commit 7d122bd15f removed usage of
`header::sealed::GetType`, so the trait can safely be removed.
2017-07-10 17:44:51 +09:00
Sean McArthur
9bb71b9bbf perf(headers): skip newline replacer for safe headers 2017-07-03 14:43:37 -07:00
Sean McArthur
7d9dfee8ce perf(header): speed up VecMap insert and get 2017-06-25 11:51:43 -07:00
Sean McArthur
7d122bd15f perf(header): optimize when inserting a new type header 2017-06-25 11:51:42 -07:00
Dmitry Konishchev
6fd46427af docs(headers): fix a typo in ContentType header's doc 2017-06-25 16:41:51 +03:00
Sean McArthur
45ce625bda test(header): add ContentType to server encode benchmark 2017-06-22 12:25:50 -07:00
Jon Gjengset
41ac9e7873 docs(headers): clarify TransferEncoding xor ContentLength
Update the docs for `Content-Length` and `Transfer-Encoding` to mention
that they are mutually exclusive, and that setting one will unset the
other, in accordance with RFC7230.

Also expand the docs for `Request::set_body` to say that chunked
encoding is used by default, and mention how to disable this feature.
2017-06-21 15:30:03 -04:00
Sean McArthur
cee8692d81 refactor(header): replace url crate with percent-encoding 2017-06-13 10:55:12 -07:00
Corey Farwell
1059eb349a style(lib): address clippy code style warnings
* Remove unnecessary return statements.

* Combine identical `match` arms.

* Collapse nested conditional.

* Use `assert_ne` where applicable.

* Lifetime elision.
2017-06-12 20:16:20 -07:00
Sean McArthur
f273224f21 feat(mime): upgrade to mime v0.3
The new mime crate has several benefits:

- Faster formatting
- Easier to use. Most common mime types are now just constants, like
  `mime::TEXT_PLAIN`.
- Proper suffix support.
- Extensible without breaking backwards compatiblity. This means we can
  always add new constants, but before we couldn't add new variants to the
  enums.
- It's now impossible for a `Mime` to contain invalid tokens. Before,
  with the `Ext(String)` variants, it was possible to create an illegal
  mime.

Closes #738

BREAKING CHANGE: Most uses of `mime` will likely break. There is no more
  `mime!` macro, nor a `Mime` constructor, nor `TopLevel` and `SubLevel`
  enums.

  Instead, in most cases, a constant exists that can now be used.

  For less common mime types, they can be created by parsing a string.
2017-06-08 13:00:12 -07:00
mayah
edc1c0dd01 fix(header): add Cookie::iter() 2017-05-29 11:16:09 -07:00
Sean McArthur
e69cd1ab3a style(header): clean up extra whitespace in ContentLength file 2017-05-25 10:34:35 -07:00
Sean McArthur
9688c8b8ae perf(header): add #[inline] to header! macros 2017-05-25 10:32:25 -07:00
Sean McArthur
40c575cc59 perf(header): move a branch out of a loop in fmt_comma_delimited 2017-05-25 10:31:20 -07:00
golem131
ca22eae5ac feat(headers): update to base64 0.5 2017-05-12 13:40:26 +03:00
Sean McArthur
c81edd41d7 refactor(lib): update unicase to 2.0
BREAKING CHANGE: Some headers used `UniCase`, but now use
  `unicase::Ascii`. Upgrade code to `Ascii::new(s)`.
2017-05-10 16:14:59 -07:00
Sean McArthur
fed04dfb58 Merge pull request #1159 from dorfsmay/ignore_invalid_cookies
Ignore invalid cookies
2017-05-08 22:46:51 -07:00
taku0
1a35310273 feat(headers): add ContentType::octet_stream() constructor 2017-05-03 18:16:36 +09:00
Yves Dorfsman
310d98d50b fix(header): ignore invalid cookies
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.
2017-04-29 14:09:24 -06:00
Yves Dorfsman
276170fd1c test(header): test valid corner cases
Test corner cases that are easy to miss when coding such as equal sign
in the cookie value and empty and empty value.
2017-04-29 13:36:55 -06:00
Sean McArthur
dd03e72392 feat(header): change Cookie to be map-like
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.
2017-04-28 13:56:32 -07:00
Sean McArthur
c3466bedf8 refactor(header): fix more ?Sized for 1.10 2017-04-26 14:52:23 -07:00
Sean McArthur
9ab67b7900 style(header): remove ?Sized from where class to fix 1.10 build 2017-04-26 13:58:56 -07:00
Sean McArthur
5130fa4bad refactor(header): remove unused VecMap.is_empty 2017-04-26 13:46:44 -07:00
Sean McArthur
8d6d9a21af refactor(header): remove some lifetime transmutes for keys in VecMap 2017-04-26 13:19:23 -07:00
Sean McArthur
38e60f7267 docs(header): update ContentType example to use ContentType::json() 2017-04-26 13:18:35 -07:00
Sean McArthur
a4644959b0 refactor(header): make Quality an opaque struct
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)`.
2017-04-26 11:22:20 -07:00
Sean McArthur
316c6fad30 refactor(header): change HttpDate to opaque over SystemTime
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.
2017-04-25 14:30:49 -07:00
Sean McArthur
011f28cb18 fix(headers): remove erronous link-extensions from Link
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.
2017-04-24 13:52:05 -07:00
Sean McArthur
6f02d43ae0 refactor(header): change Header::fmt_header to take a header::Formatter
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)`.
2017-04-24 10:56:05 -07:00
Alexander Mielczarek
f1859dfd7a feat(headers): add TE header struct (#1150)
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`.
2017-04-24 10:21:06 -07:00
Alexey Zabelin
414859978b feat(headers): support Opaque origin headers (#1147)
Add support for Opaque origin header, serializing it to `null`.
https://html.spec.whatwg.org/multipage/browsers.html#concept-origin

Closes #1065

BREAKING CHANGE: `Origin.scheme` and `Origin.host` now return `Option`s,
  since the `Origin` could be `null`.
2017-04-24 10:05:56 -07:00