Commit Graph

1025 Commits

Author SHA1 Message Date
Sean McArthur
4bd9746a0f fix(header): fix panic from headers.remove when typed doesn't match 2017-07-24 15:22:58 -07:00
Sean McArthur
6f1a87097e style(lib): add must_use attributes to futures and streams 2017-07-24 10:11:29 -07:00
Sean McArthur
9b47e1861a fix(http): allow zero-length chunks when no body is allowed 2017-07-18 12:06:11 -07:00
Sean McArthur
89f780309b Merge pull request #1256 from brendanzab/add-missing-headers
feat(headers): Add missing headers
2017-07-17 16:45:18 -07:00
Sean McArthur
fc5b9cce31 fix(http): fix encoding when buffer is full 2017-07-17 11:19:32 -07:00
Sean McArthur
d6da3f7b40 fix(http): skip zero length chunks when encoding 2017-07-17 10:41:36 -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
Sean McArthur
673e5cb1a3 fix(server): improve detection of when a Response can have a body
By knowing if the incoming Request was a HEAD, or checking for 204 or
304 status codes, the server will do a better job of either adding
or removing `Content-Length` and `Transfer-Encoding` headers.

Closes #1257
2017-07-13 12:19:53 -07:00
Sean McArthur
5f47d72347 Merge pull request #1244 from gotham-rs/add-response-body_ref-function
feat(server): Provide reference to Response body
2017-07-13 09:08:14 -07: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
14cbd40071 fix(server): reject Requests with invalid body lengths
- Checks for that the `Transfer-Encoding` header has `chunked` as its
  last encoding
- Makes `Transfer-Encoding` take priority over `Content-Length`
- Rejects requests that contain a `Content-Length` header, but is
  invalid (or contains multiple with different values).
2017-07-06 11:58:43 -07:00
Bradley Beddoes
a79fc98e36 feat(server): Provide reference to Response body
The Response body was previously inaccessible to application code. This
change allows applications that may wish to alter the Response based on
previous creation (or not) of the body to do so.

n.b. discussion in #1216 indicates this function may change in
0.12 or be removed in favour of some other api.

Closes #1216.
2017-07-06 10:44:51 +10:00
Sean McArthur
c4c89a22f8 fix(server): do not automatically set ContentLength for 204 and 304 Responses 2017-07-04 12:52:41 -07:00
Sean McArthur
81c0d185bd fix(client): don't assume bodies on 204 and 304 Responses
Closes #1242
2017-07-04 12:42:02 -07:00
Sean McArthur
7ce3121132 v0.11.1 2017-07-03 15:08:38 -07:00
Sean McArthur
9bb71b9bbf perf(headers): skip newline replacer for safe headers 2017-07-03 14:43:37 -07:00
wangcong
d7edc19af2 style(client): rename req to resp 2017-07-03 09:00:11 -07:00
Sean McArthur
c4835c506d refactor(http): grab io.write_buf_mut only once in write_head 2017-06-26 11:14:57 -07:00
Sean McArthur
04d34f4b65 chore(lib) shuffle around some debug! and info! calls 2017-06-26 10:56:03 -07:00
Sean McArthur
3d85ad057c perf(http): fetch the current Task far less often 2017-06-26 09:35:35 -07:00
Steven Fackler
6164e76405 feat(server): Handle 100-continue
cc #838
2017-06-25 13:14:32 -07:00
Sean McArthur
7d9dfee8ce perf(header): speed up VecMap insert and get 2017-06-25 11:51:43 -07:00
Sean McArthur
42f5f78de0 perf(method): improve logic of parsing a Method 2017-06-25 11:51:43 -07:00
Sean McArthur
c165db495e perf(server): put inline on all wrapper methods 2017-06-25 11:51:43 -07:00
Sean McArthur
e859f89942 refactor(http): reduce complexity of Conn::start_send 2017-06-25 11:51:43 -07:00
Sean McArthur
4dfe0db0f4 perf(server): dont record Idle time when not needed 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
Yazad Daruvala
3021cd9dd8 refactor(uri): make ByteStr an implementation detail of uri 2017-06-23 21:58:15 -07:00
Sean McArthur
579d360f51 chore(status): remove dead code 2017-06-22 21:10:10 -07:00
Sean McArthur
b4be22db56 docs(http): remove 'client' from docs of Request and Response 2017-06-22 21:09:50 -07:00
Sean McArthur
45ce625bda test(header): add ContentType to server encode benchmark 2017-06-22 12:25:50 -07:00
Yazad Daruvala
5ed9e31b82 refactor(http): Buffered::read_from_io now returns Poll 2017-06-22 01:01:00 -07:00
Yazad Daruvala
a0c3a33eda refactor(http): Buffered::parse now returns Poll 2017-06-22 01:01:00 -07:00
Yazad Daruvala
80f16f1917 refactor(http): Decoder::decode and MemRead in io now return Poll 2017-06-22 01:01:00 -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
e92b57c4f5 v0.11.0 2017-06-13 12:54:29 -07:00
Sean McArthur
cee8692d81 refactor(header): replace url crate with percent-encoding 2017-06-13 10:55:12 -07:00
Sean McArthur
f953cafe27 feat(status): add StatusCode::try_from(u16).
This is a temporary function until the `TryFrom` trait stabilizes.

BREAKING CHANGE: Removes the undocumented `from_u16` function. Use
  `StatusCode::try_from` instead.

  Also makes the `status` module private. All imports of
  `hyper::status::StatusCode` should be `hyper::StatusCode`.
2017-06-13 09:50:46 -07:00
Sean McArthur
c166268c07 fix(client): prevent panicking when determine Expiration in pool
On some OSes, `Instant` would start counting 0 from the boot time. That
would mean that any `Instant::now() - dur` soon after boot had a higher
risk of overflowing. Now, the expiration is determined by calling
`idle.elapsed()`, and comparing durations.

Closes #1215
2017-06-13 09:21:56 -07:00
Sean McArthur
620e00c6da docs(guides): add a link to guides in doc homepage 2017-06-12 20:27:18 -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
5d19ef88b4 test(status): fixes tests from removing 2017-06-12 17:04:55 -07:00
Sean McArthur
94ee6204ae feat(status): remove deprecated StatusClass
BREAKING CHANGE: All usage of `status.class()` should change to
  equivalent `status.is_*()` methods.
2017-06-12 16:27:25 -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
Sean McArthur
e2ed6f5868 refactor(chunk): make use of Bytes::extend instead of custom code 2017-06-07 17:48:26 -07:00
Corey Farwell
059f2b8725 chore(net): remove empty net file 2017-06-06 23:54:14 -07:00
Sean McArthur
acd62cda44 feat(lib): add raw_status feature in Cargo.toml
The `RawStatus` types on the `Response` are now gone by default. To make
use of them, the `raw_status` feature must be enabled in `Cargo.toml`.

BREAKING CHANGE: To use `RawStatus`, you must enable the `raw_status`
  crate feature.
2017-06-03 16:23:33 -07:00
Sean McArthur
76fc633613 Merge pull request #1199 from daboross/patch-1
fix(client): remove config requirement for Connect
2017-06-03 14:55:07 -07:00