Commit Graph

2093 Commits

Author SHA1 Message Date
Sean McArthur
069a32b1ac v0.12.7 2018-07-23 09:51:38 -07:00
Sean McArthur
6530a00a8e fix(http1): reduce closed connections when body is dropped
If a user makes use of `Body::is_end_stream` to optimize so as to not
need to do make a final poll just to receive `None`, previously the
connection would not have progressed its reading state to a finished
body, and so the connection would be closed.

Now, upon reading any chunk, the connection state will check if it
can know that the body would be finished, and progresses to a body
finished state sooner.

The integration tests were amplified by adding a naive hyper proxy
as a secondary test, which happens to make use of that optimization,
and thus caught the issue.
2018-07-23 09:39:19 -07:00
Sonny Scroggin
05c1179e82 docs(upgrade): fix link to upgrade example
Closes #1608
2018-07-20 22:25:07 -07:00
Sean McArthur
8a04a97464 v0.12.6 2018-07-11 17:20:20 -07:00
Sean McArthur
b41eabfe64 chore(readme): adjust note about instability around futures 2018-07-11 17:19:20 -07:00
Igor Gnatenko
7b54e9ccae chore(dependencies): update want to 0.0.6 2018-07-11 14:20:39 -07:00
Eli Snow
13862d11ad feat(client): add ability to include SO_REUSEADDR option on sockets
Closes #1599
2018-07-11 12:13:59 -07:00
Hrvoje Ban
02a9c29e2e feat(client): implement rfc 6555 (happy eyeballs)
Update client connector to attempt a parallel connection using
alternative address family, if connection using preferred address family
takes too long.

Closes: #1316
2018-07-10 13:43:03 -07:00
Sean McArthur
5b5e309095 feat(server): add Builder::http1_pipeline_flush configuration
However, you probably shouldn't use it! It's `doc(hidden)`, since it
isn't the truest pipeline support. Instead, it just prevents flushing
until read buffer has been consumed.

It's only real use is for silly pipeline benchmarks.
2018-07-09 12:56:54 -07:00
Jonas Platte
51223efb8a docs(lib): Fix some typos 2018-07-08 10:10:12 -07:00
Sean McArthur
ae34a86cc3 docs(examples): add a stateful server example with a request counter 2018-07-06 15:24:01 -07:00
Sean McArthur
8991707a6a perf(http1): propagate service user error generic further into dispatcher
In the case of `Never`, this allows the optimizer to eliminate more code
inside the dispatcher, winning some more performance in benchmarks.
2018-07-06 15:01:53 -07:00
Özgür Akkurt
bff37244d8 docs(server): clean the web_api example up
add comments and a json example

closes #1595
2018-07-06 12:37:50 -07:00
Özgür Akkurt
9cd971d8f3 docs(client): improve client_json example 2018-07-06 12:37:50 -07:00
Özgür Akkurt
396e6022e0 docs(server): mention http2 support
mention http2 support in server module documentation.

Closes #1578
2018-07-05 10:38:13 -07:00
Sean McArthur
a2a6e36cca doc(readme): add note about contributing and chat links 2018-07-04 13:26:58 -07:00
ozgurakkurt
e06dc52ef6 docs(client): Add client_json example
Closes #1581
2018-07-03 14:41:50 -07:00
Sean McArthur
d42c983e3b test(http1): fix unused import warnings of Bytes when debug_assertions are off 2018-06-29 14:14:29 -07:00
Sean McArthur
b9ab8be986 refactor(common): ensure empty StaticBufs don't make IoVecs 2018-06-29 14:13:41 -07:00
Sean McArthur
5a3efda0e7 v0.12.5 2018-06-28 20:53:50 -07:00
Sean McArthur
6aff27523a chore(h2): fix minimum h2 version 2018-06-28 18:00:12 -07:00
Sean McArthur
8cf6f145ac v0.12.4 2018-06-28 16:21:27 -07:00
Sean McArthur
c03c39e0ff fix(client): fix keep-alive header detection when parsing responses 2018-06-28 15:15:50 -07:00
Sean McArthur
e7c7f2db05 refactor(h1): give better panics in debug mode when headers successfully parse illegal values 2018-06-28 12:53:54 -07:00
Sean McArthur
f2d464ac79 fix(client): try to reuse connections when pool checkout wins
If a checkout wins, meaning an idle connection became available before
a connect future completed, instead of just dropping the connect future,
it spawns it into the background executor to allow being placed into
the pool on completion.
2018-06-28 12:43:56 -07:00
Sean McArthur
1f95f58837 chore(error): improve message about incomplete parsed messages 2018-06-25 17:29:40 -07:00
Sean McArthur
1156e17e65 chore(error): add specific user error for responding with 1xx status code 2018-06-25 17:16:09 -07:00
Laurențiu Nicola
91b08d09e4 chore(headers): use HeaderValue::from for content-length (#1583) 2018-06-25 16:17:08 -07:00
Sean McArthur
d7436cfbe0 v0.12.3 2018-06-25 12:46:41 -07:00
Sean McArthur
e61fe54093 test(server): fix unused result from block_on 2018-06-25 11:48:52 -07:00
Sean McArthur
6848ba63fb test(server): use current_thread instead of rt::run with http2 tests 2018-06-25 11:35:57 -07:00
Josh Leeb-du Toit
ffdb478831 feat(http2): quickly cancel when receiving RST_STREAM
Update Http2 proto to cancel quick when the stream is reset, on an
`RST_STREAM` frame.

Closes: #1549
2018-06-25 11:14:35 -07:00
Sean McArthur
2a3844acc3 feat(client): enable CONNECT requests through the Client
While the upgrades feature enabled HTTP upgrades in both and the server and client, and the goal was for `CONNECT` requests to work as well, only the server could use them for `CONNECT`. The `Client` had some specific code rejecting `CONNECT` requests, and this removes it and prepares the `Client` to handle them correctly.
2018-06-22 21:00:28 -07:00
Sean McArthur
f698b03e57 perf(headers): don't allocate to format content-length on 32bit when number is not huge 2018-06-22 11:39:32 -07:00
Sean McArthur
ac1af8d15b perf(headers): switch from fmt to itoa when writing content-length header 2018-06-20 17:19:37 -07:00
Sean McArthur
7d8897537b refactor(lib): improve some trace logs for upgrades 2018-06-19 17:38:03 -07:00
Sean McArthur
9b4083de6b v0.12.2 2018-06-19 11:30:05 -07:00
Sean McArthur
61f31b5a4a doc(client): show spawning a client future, clarify lazy in client example 2018-06-18 17:02:57 -07:00
Sean McArthur
482a5f589e fix(lib): return an error instead of panic if execute fails
If executing an internal task fails, a new variant of `hyper::Error` is
returned to the user, with improved messaging.

If a non-critical task fails to spawn, it no longer panics, instead just
logging a warning.

Closes #1566
2018-06-18 16:01:04 -07:00
Sean McArthur
27db8b0061 feat(client): add set_scheme, set_host, and set_port for Destination
Closes #1564
2018-06-18 15:21:41 -07:00
Sean McArthur
e4ebf44823 chore(tests): change tests to use current_thread runtime 2018-06-18 12:30:56 -07:00
Josh Leeb-du Toit
9a28268b98 feat(http2): Add content_length() value to incoming h2 Body
- Add `Body::Kind::H2` to contain the content length of the body.
- Update `Body::content_length` to return the content length if `Body::Kind` is `H2`, instead of returning `None`.

Reference: #1556, #1557

Closes #1546
2018-06-18 11:50:12 -07:00
Sean McArthur
29a8074689 chore(dependencies): update want to 0.0.5 2018-06-14 13:41:03 -07:00
Sean McArthur
fea29b29e2 feat(http1): Add higher-level HTTP upgrade support to Client and Server (#1563)
- Adds `Body::on_upgrade()` that returns an `OnUpgrade` future.
- Adds `hyper::upgrade` module containing types for dealing with
  upgrades.
- Adds `server::conn::Connection::with_upgrades()` method to enable
  these upgrades when using lower-level API (because of a missing
  `Send` bound on the transport generic).
- Client connections are automatically enabled.
- Optimizes request parsing, to make up for extra work to look for
  upgrade requests.
  - Returns a smaller `DecodedLength` type instead of the fatter
    `Decoder`, which should also allow a couple fewer branches.
  - Removes the `Decode::Ignore` wrapper enum, and instead ignoring
    1xx responses is handled directly in the response parsing code.

Ref #1563 

Closes #1395
2018-06-14 13:39:29 -07:00
Steven Fackler
1c3fbfd6bf feat(h2): implement flow control for h2 bodies
Closes #1548
2018-06-11 11:32:50 -07:00
Laurențiu Nicola
386fc0d70b feat(http2): set Content-Length header on outgoing messages
Closes #1547
2018-06-10 15:22:30 -07:00
Josh Leeb-du Toit
f20afba57d feat(http2): Strip connection headers before sending
Automatically removes "connection" headers before sending over HTTP2.
These headers are illegal in HTTP2, and would otherwise cause errors.

Closes: #1551
2018-06-08 17:31:22 -07:00
Laurențiu Nicola
a0a0fcdd9b feat(body): make Body know about incoming Content-Length
When getting a `Body` from hyper, such as in a client response,
the method `Body::content_length()` now returns a value if the header
was present.

Closes #1545
2018-06-08 13:00:46 -07:00
Sean McArthur
396fe80e76 fix(server): fix debug assert failure when kept-alive connections see a parse error 2018-06-07 15:08:53 -07:00
Sean McArthur
d7ab016676 fix(server): correctly handle CONNECT requests
- In the higher-level `Server` API, since connection upgrades aren't yet
  supported, returning a 2xx response to a `CONNECT` request is a user
  error. A 500 response is written to the client, the connection is
  closed, and an error is reported back to the user.
- In the lower-level `server::Connection` API, where upgrades *are*
  supported, a 2xx response correctly marks the response as the final
  one, instead of trying to parse more requests afterwards.
2018-06-07 14:59:01 -07:00