Commit Graph

1191 Commits

Author SHA1 Message Date
Sean McArthur
8b8ed46e56 Merge pull request #1015 from hyperium/unflaky
test(client): disable flaky disconnect test
2017-01-17 17:43:46 -08:00
Sean McArthur
49e281d086 test(client): disable flaky disconnect test 2017-01-17 17:25:55 -08:00
derekdreery
b64665635f docs(headers): Explain content_type assigned type
Explain why content_type mime params are not generic over slice.

Related to #991
2017-01-17 16:05:54 -08:00
Sean McArthur
1868f8548d refactor(http): remove buffer, use WriteBuf 2017-01-16 18:56:36 -08:00
Kornelijus Survila
6e4739f918 fix(http): Fix heap corruption in http::buffer::grow_zerofill
Fixes #1010
2017-01-16 14:24:09 -08:00
Sean McArthur
e4232dd0d8 test(client): sleep disconnect test to reduce flakiness
Closes #1003
2017-01-16 12:58:06 -08:00
Sean McArthur
fef401921c chore(travis): only test integration benches, not run full benchmarks 2017-01-16 12:46:19 -08:00
Sean McArthur
1520d97ec1 chore(changelog): update changelog from 0.10.x 2017-01-16 10:53:38 -08:00
Sean McArthur
f0ab2b6aed feat(header): add Encoding::Brotli variant
BREAKING CHANGE: This adds a new variant to the `Encoding` enum, which
  can break exhaustive matches.
2017-01-16 10:50:36 -08:00
Sean McArthur
cd9fd52207 refactor(header): Host header internals made private
This allows us to improve the performance. For now, a Cow is used
internally, so clients can set the host to a static value and no longer
need copies.

Later, we can change it to also possibly have a MemSlice.

BREAKING CHANGE: The fields of the `Host` header are no longer
  available. Use the getter methods instead.
2017-01-16 10:50:36 -08:00
Sean McArthur
0167f57d65 docs(cookie): fix examples for Cookie and SetCookie 2017-01-16 10:50:36 -08:00
Sean McArthur
637b170f52 refactor(header): change Cookie and SetCookie to use String
This removes the cookie crate, since it has an optional dependency on
openssl, which can cause massive breakage if toggled on. Instead, the
`Cookie` and `SetCookie` headers now just use a `String`. Anyone can
create any typed header, so it is easy to plug in different
implementations.

BREAKING CHANGE: The `Cookie` and `SetCookie` headers no longer use the
  cookie crate. New headers can be written for any header, or the ones
  provided in hyper can be accessed as strings.
2017-01-16 10:50:35 -08:00
Sean McArthur
0a58f7e3b5 chore(travis): fix docs publish script 2017-01-16 10:50:35 -08:00
Sean McArthur
2f721c7f05 chore(travis): check for doc directory before building extra docs 2017-01-16 10:50:35 -08:00
Sean McArthur
0686c81c57 refactor(error): turn Void from an empty enum to a struct 2017-01-16 10:50:35 -08:00
Sean McArthur
ff84959f83 chore(lib): bump version to 0.11.0-a 2017-01-16 10:50:35 -08:00
Sean McArthur
be461b4663 perf(http): introduce MemBuf, a shared read buffer 2017-01-16 10:50:35 -08:00
Sean McArthur
2d2d5574a6 feat(lib): redesign API to use Futures and Tokio
There are many changes involved with this, but let's just talk about
user-facing changes.

- Creating a `Client` and `Server` now needs a Tokio `Core` event loop
to attach to.
- `Request` and `Response` both no longer implement the
`std::io::{Read,Write}` traits, but instead represent their bodies as a
`futures::Stream` of items, where each item is a `Chunk`.
- The `Client.request` method now takes a `Request`, instead of being
used as a builder, and returns a `Future` that resolves to `Response`.
- The `Handler` trait for servers is no more, and instead the Tokio
`Service` trait is used. This allows interoperability with generic
middleware.

BREAKING CHANGE: A big sweeping set of breaking changes.
2017-01-16 10:44:27 -08:00
Sean McArthur
e23689122a Merge pull request #989 from d-unseductable/docs/response_set_status
docs(server): fix Response::set_status() documentation
2017-01-08 20:16:39 -08:00
Dmitry Gritsay
334c4800bb docs(server): fix Response::set_status() documentation 2017-01-07 15:01:37 +02:00
Sean McArthur
bf2b8faa73 Merge pull request #979 from jamesmunns/fix-lint-errs
refactor(client): remove unused client type aliases
2016-12-31 15:23:50 -08:00
James Munns
ce71398f48 refactor(client): remove unused client type aliases
These type aliases cause test build to fail due to strict LINT settings
2016-12-31 15:39:37 +01:00
Sean McArthur
bdc19d52bf feat(headers): add star, json, text, image constructors to Accept 2016-12-10 12:22:08 -08:00
Sean McArthur
0b02e61791 chore(travis): pipe git commands to dev null 2016-11-19 14:56:35 -08:00
Sean McArthur
bca63e54b9 Merge pull request #962 from shanegibbs/move-hup-check-2
fix(http): move hup check before writable check
2016-11-18 10:00:10 -08:00
Shane Gibbs
3f34f2bd1d fix(http): move hup check before writable check 2016-11-18 16:03:58 +00:00
Shane Gibbs
359493f973 fix(http): move hup check after read/write check 2016-11-17 18:14:01 -08:00
Sean McArthur
02f01765ee fix(tests): update new Host header tests to use Raw 2016-11-16 12:57:09 -08:00
Markus Unterwaditzer
8541ac72d7 fix(headers): Allow IPv6 Addresses in Host header 2016-11-01 14:44:56 -07:00
Sean McArthur
c3c53dda32 Merge pull request #943 from mrnayak/ref-policy-header
feat(headers): Add strict-origin and strict-origin-when-cross-origin referer policy
2016-10-28 15:16:15 -07:00
Raghav
3593d7987a feat(headers): Add strict-origin and strict-origin-when-cross-origin referer policy
Support for strict-origin and strict-origin-when-cross-origin in referer
policy required for imporving network security. This commit will attempt
to add missing pieces of referrer policy.
2016-10-28 16:56:40 -04:00
Sean McArthur
fe7f819929 Merge pull request #938 from jwilm/add-openssl-blocked-impl
fix(net): Implement `blocked()` for OpensslStream
2016-10-18 22:47:58 -07:00
Joe Wilm
ac5d0ab3fe fix(net): Implement blocked() for OpensslStream
This should fix some busy looping when using OpenSSL. For example, if
the transport was blocked on a read, it wasn't surfaced to the
`http::Conn` and so the wrong interest was registered with the event
loop. Registering for the wrong interest triggered calls to
`http::Conn::ready()` which were unable to make progress.
2016-10-18 15:14:43 -07:00
Sean McArthur
cd6c1b60bb Merge pull request #936 from jwilm/fix-chunked-decode
fix(http): Chunked decoder reads last \r\n
2016-10-17 21:43:37 -07:00
Joe Wilm
bffde8c841 fix(http): Chunked decoder reads last \r\n
Before this, the final \r\n for an empty body was not being read. This
caused issues with keep-alive connections.
2016-10-17 17:40:40 -07:00
Sean McArthur
7de6f2b178 Merge pull request #933 from jwilm/misc-client-fixes
Misc client fixes
2016-10-14 12:20:22 -07:00
Joe Wilm
20fac49aa9 fix(http): Prevent busy looping
We encountered some issues where the `Conn::ready()` would busy loop on
reads. Previously, the `ConnInner::can_read_more()` would not consider
whether the previous read got a WouldBlock error, and it didn't consider
whether the transport was blocked. Accounting for this additional state
fixes the busy loop problem.
2016-10-13 14:38:36 -07:00
Joe Wilm
ff556199e6 fix(client): Improve keep-alive reuse strategy
The previous keep-alive strategy was to cycle connections in a
round-robin style. However, that will always keep more connections
around than are needed. This new strategy will allow extra connections
to expire when only a few are needed. This is accomplished by prefering
to reuse a connection that was just released to the pool over one that
has been there for a long time.
2016-10-13 14:38:31 -07:00
Joe Wilm
915af2a3a8 fix(http): Handle readable in keep-alive
It's possible that a connection will be closed and the only way to find
out is by doing a read. The keep-alive state (State::Init + Next_::Wait)
now tries to read on readable. In the case of EOF, it returns state
closed. If bytes are actually available, it's a connection error, and
the connection is closed. Otherwise, it's just a spurious wakeup.
2016-10-13 14:38:26 -07:00
Joe Wilm
34c4d72712 fix(client): Always register for hup 2016-10-13 14:38:19 -07:00
Joe Wilm
ef4c08c9e9 fix(client): Handle connection error
Previously, the connection would be kept alive if there was a connect
error. Now it's closed immediately.
2016-10-13 14:38:10 -07:00
Tshepang Lekhonkhobe
d5df3fd1b5 docs(headers): remove extraneous space 2016-10-13 14:25:52 -07:00
Sean McArthur
27a480c327 Merge pull request #930 from jwilm/handle-keep-alive-hangup
fix(conn): Handle remote hangup
2016-10-10 16:24:37 -07:00
Joe Wilm
9652a42d45 fix(conn): Handle remote hangup
Not handling this was an issue for keep-alive connections because
requests would get assigned to a closed connection and then immediately
error. Handling the HUP event makes this situation much less likely. It
is still possible however; consider the situation where a HUP arrives
while the event loop is busy processing new requests to add. The
connection is disconnected, but the HUP hasn't been processed, and a
request could be assigned to it. This case is, however, unlikely.
2016-10-10 15:44:51 -07:00
Sean McArthur
c2734c6330 Merge pull request #920 from gsquire/referrer-update
Referrer-Policy Header
2016-10-08 18:22:45 -07:00
Sean McArthur
73da844401 Merge pull request #925 from jwilm/fix-spurious-timeouts
fix(http): Connection checks for spurious timeouts
2016-10-08 13:28:50 -07:00
Garrett Squire
7b558ae87a feat(headers): support multiple values for Referrer-Policy header
Closes #882
2016-10-08 11:10:07 -07:00
Joe Wilm
934f2c481b fix(http): Connection checks for spurious timeouts
We've been seeing a strange number of timeouts in our benchmarking.
Handling spurious timeouts as in this patch seems to fix it!

Note that managing the `timeout_start` needs to be done carefully. If
the current time is provided in the wrong place, it's possible requests
would never timeout.
2016-10-07 17:59:47 -07:00
Sean McArthur
588ef9d252 Merge pull request #923 from jwilm/fix-stack-overflow
fix(http): stackoverflow in Conn::ready
2016-10-06 18:31:09 -07:00
Joe Wilm
c32d0e9adf fix(http): stackoverflow in Conn::ready
I've had a couple of instances during stress testing now where
Conn::ready would overflow its stack due to recursing on itself. This
moves subsequent calls to ready() into a loop outside the function.
2016-10-06 18:02:26 -07:00