Commit Graph

1318 Commits

Author SHA1 Message Date
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
Shane Gibbs
8672ec5a36 fix(http): make Chunked decoder resilient in an async world 2016-10-06 15:47:03 -07:00
Sean McArthur
0fad665dda Merge pull request #922 from jwilm/configurable-dns-worker-count
feat(client): DNS worker count is configurable
2016-10-06 15:45:56 -07:00
Sean McArthur
37daf1abcb Merge pull request #921 from jwilm/fix-keep-alive
fix(client): keep-alive works as intended now
2016-10-06 15:01:24 -07:00
Joe Wilm
138e1643e8 feat(client): DNS worker count is configurable
When loading up a client suddenly with thousands of connections, the
default DNS worker count of four cannot keep up and many requests
timeout as a result. Most people don't need a large pool, so making this
configurable is a natural choice.
2016-10-06 14:50:30 -07:00
Joe Wilm
15d9da5eb9 fix(client): keep-alive works as intended now
We observed an issue where connection were not ever entering the
keep-alive state due to a bug with `State::update`. The issue is
resolved with resetting the write state to KeepAlive when it arrives as
KeepAlive. Otherwise, it would be marked incorrectly as Closed.

The `trace!` lines in here are useful for debugging keep-alive issues so
I've left them in.
2016-10-06 14:04:01 -07:00
Sean McArthur
f9f13ea317 Merge pull request #919 from jwilm/name-dns-threads
Spawn client DNS threads with descriptive name
2016-10-01 14:49:00 -07:00
Joe Wilm
b4c65086af fix(client): Spawn DNS threads with name
Resolves #918.
2016-10-01 12:19:06 -07:00
Sean McArthur
a6064a639a Merge pull request #917 from gsquire/export-ParseError
Issue 914
2016-09-23 09:45:12 -07:00
Garrett Squire
3636a3e855 refactor(error): export url::ParseError in hyper's error module
Closes #914
2016-09-22 15:39:36 -07:00
Sean McArthur
bed4815d69 Merge pull request #916 from jwilm/full-slab-evict-idle
Evict idle connections when client is full
2016-09-22 10:39:33 -07:00
Joe Wilm
27cab3766d fix(client): Evict idle connections when full
In the scenario where a request is started on the `Client`, the client
has a full slab, and sockets for a *different* domain are idling in
keep-alive, the new request would previously cause the client to panic!.

This patch adds a `spawn_error` handler which attempts to evict an idle
connection to make space for the new request. If space cannot be made,
the error handler is run (passed `Error::Full`) and the `Handler` is
dropped.

This is a breaking change because of the new variant of `Error`.

Some inefficient use of `Vec` in the client was replaced with `VecDeque`
to support push/pop from either end.
2016-09-21 17:52:38 -07:00
Sean McArthur
8c6e6f51ab Merge pull request #910 from smithsps/feat-warning-header
feat(headers): add Warning header
2016-09-06 15:59:52 -07:00
Simon Smith
69894d1994 feat(headers): add Warning header
Implements Warning header from RFC7234
Closes #883
2016-09-05 14:35:48 -04:00
Ahmed Charles
8b3c120684 feat(server): add path() and query() to Request
Closes #896 
Closes #897

BREAKING CHANGE: `RequestUri::AbsolutePath` variant is changed to a struct variant. Consider using `req.path()` or `req.query()` to get the relevant slice.
2016-08-29 13:45:38 -07:00
Sean McArthur
a228486a85 Merge pull request #905 from YetAnotherMinion/enh-update_num_cpus_version
refactor(version): bump version of num_cpus to 1.0
2016-08-27 19:43:22 -07:00
YetAnotherMinion
c8b48c7efd refactor(version): bump version of num_cpus to 1.0 2016-08-27 14:03:24 -04:00
Markus Unterwaditzer
9375addba0 feat(headers): Headers::remove returns the Header
Closes #891

BREAKING CHANGE: `Headers.remove()` used to return a `bool`,
  it now returns `Option<H>`. To determine if a a header exists,
  switch to `Headers.has()`.
2016-08-23 16:46:07 -04:00
Sean McArthur
74136de960 Merge pull request #889 from aidanhs/aphs-not-v1-warning
Note on pre 1.0
2016-08-11 15:45:01 -07:00
Aidan Hobson Sayers
d53e033704 docs(version): note on pre 1.0 stability 2016-08-11 22:42:28 +01:00
Sean McArthur
0ce83dfbb3 Merge pull request #878 from nox/serde
Update serde to 0.8
2016-08-07 10:29:22 -07:00
Sean McArthur
c497dfcc93 Merge pull request #879 from nox/cookie
Update cookie to 0.3
2016-08-07 10:29:08 -07:00
Sean McArthur
f51b799023 Merge pull request #884 from hyperium/perf
A couple performance boosts
2016-08-06 10:58:36 -07:00
Sean McArthur
a3a815c09c perf(http): reduce server loops when headers and body are ready 2016-08-06 00:11:45 -07:00