Commit Graph

1665 Commits

Author SHA1 Message Date
Sean McArthur
1207c2b624 feat(client): introduce lower-level Connection API
Closes #1449
2018-03-07 14:26:52 -08:00
Sean McArthur
0786ea1f87 v0.11.22 2018-03-07 12:56:57 -08:00
Sean McArthur
bfcdbd9f86 fix(client): return error if Request has CONNECT method
The higher-level `Client` has never supported `CONNECT` requests,
but it used to send them, and then handle the responses incorrectly.
Now, it will return an error immediately instead of misbehaving.
2018-03-06 10:48:59 -08:00
Sean McArthur
33a385c6b6 feat(client): add Config::set_host option
If set to false, the `Client` will no longer automatically set the
`Host` header if absent.
2018-03-06 10:37:40 -08:00
Sean McArthur
3e87eb48b1 tests(client): fix client test warnings 2018-03-05 15:37:50 -08:00
Sean McArthur
994bcd193c tests(client): make retryable request tests more reliable 2018-03-05 15:05:24 -08:00
Klaus Purer
49fcb0663c fix(dependencies): require tokio-core 0.1.11 2018-03-05 10:32:31 -08:00
Sean McArthur
9990e273f6 test(server): fix streaming_body incorrect test 2018-03-01 14:13:02 -08:00
Sean McArthur
4351ed1d13 chore(client): fix unused_mut warning in 1.18 2018-02-28 16:45:43 -08:00
Sean McArthur
f7102ae6c4 v0.11.21 2018-02-28 15:17:02 -08:00
Sean McArthur
2fa0c845b5 fix(client): check conn is closed in expire interval 2018-02-28 15:16:01 -08:00
Sean McArthur
4aab54eebc Merge branch 'pool-expired' 2018-02-28 14:58:22 -08:00
Sean McArthur
727b74797e fix(client): schedule interval to clear expired idle connections
Currently only works if Client is built with a `Handle`, and not a
custome executor, since a `Handle` is required to create a tokio
Interval.
2018-02-28 14:57:06 -08:00
Sean McArthur
13741f5145 fix(client): never call connect if idle connection is available
The HttpConnector's connect future was lazy, but if any custom connector
did not use a lazy future, then a connect would always be started, even
if an idle connection was available.
2018-02-28 14:18:37 -08:00
Sean McArthur
1223fc28ee wip 2018-02-28 13:58:38 -08:00
Sean McArthur
ad7763072c v0.11.20 2018-02-26 15:07:38 -08:00
Sean McArthur
8743c86660 refactor(server): adjust accept error debug log 2018-02-26 14:52:16 -08:00
Sean McArthur
43e8ec4622 Merge pull request #1450 from klausi/sleep_on_errors
fix(server): Sleep on socket IO errors
2018-02-26 13:41:21 -08:00
Klaus Purer
4927f143a2 Merge branch 'master' into sleep_on_errors 2018-02-25 22:24:03 +01:00
Sean McArthur
3fa191a267 feat(request): add Request::body_mut() method 2018-02-24 12:16:25 -08:00
Sean McArthur
2f45d5394a feat(body): add Body::is_empty() method 2018-02-24 11:54:02 -08:00
Klaus Purer
3a36eb5596 fix(server): Make sleep_on_errors configurable and use it in example 2018-02-24 16:19:01 +01:00
Klaus Purer
68458cde57 fix(server): Sleep on socket IO errors 2018-02-24 16:03:46 +01:00
Sean McArthur
b79f8d32b5 chore(ci): don't build docs on rust 1.18 2018-02-21 13:45:54 -08:00
Sean McArthur
36eabbb18f v0.11.19 2018-02-21 13:15:57 -08:00
Sean McArthur
6d5bb85700 docs(server): add example to serve_connection 2018-02-21 13:14:42 -08:00
Sean McArthur
e6647aa679 Merge pull request #1444 from mikeyhew/docs-basic-fromstr
docs(headers): document the fact that <Basic as FromStr>::from_str takes a base-64 encoded string
2018-02-20 13:55:30 -08:00
Michael Hewson
ba6fcf33b0 docs(headers): document the fact that <Basic as FromStr>::from_str takes a base-64 encoded string
I couldn't figure out why my "username:password" strings kept failing to parse
into a Basic auth header, until I realized that the implementation expects
it to be base-64 encoded, which would be the case if it was coming from HTTP.
I'm not sure if this is the best place to document it, but hopefully it will
make it more clear for other people / me when I forget.

Perhaps a better approach would be to document somewhere that all `FromStr` impls for
headers are there for parsing request headers, and not really for creating them.
2018-02-19 23:56:55 -05:00
Sean McArthur
77adab4ebf fix(client): prevent empty bodies sending transfer-encoding for GET, HEAD 2018-02-16 15:22:06 -08:00
Sean McArthur
dd79a4a0e0 chore(client): fix unused_mut in 1.18 2018-02-15 14:54:56 -08:00
Sean McArthur
6244526a5b chore(tests): fix not-compiling tests 2018-02-15 12:55:02 -08:00
Sean McArthur
39e03a91e2 perf(server): set TCP keepalive when default listener is used 2018-02-15 12:49:52 -08:00
Sean McArthur
6ef22da8ea perf(client): set TCP keepalive when default connector is used 2018-02-15 12:40:38 -08:00
Sean McArthur
ee61ea9adf feat(client): Client will retry requests on fresh connections
If a request sees an error on a pooled connection before ever writing
any bytes, it will now retry with a new connection.

This can be configured with `Config::retry_canceled_requests(bool)`.
2018-02-15 12:04:58 -08:00
Sean McArthur
0ea3bcf8d5 refactor(server): add debug log when server accepts new connection 2018-02-12 18:21:20 -08:00
Sean McArthur
dc619a8fa0 fix(client): detect connection closes as pool tries to use
Currently, if the remote closes the connection at the same time that the
pool selects it to use for a new request, the connection may actually
hang. This fix will now more allow the keep-alive read to check the
socket even when the `Conn` think it's busy.

If the connection was closed before the request write happened, returns
back an `Error::Cancel`, letting the user know they could safely retry
it.

Closes #1439
2018-02-12 18:16:21 -08:00
Sean McArthur
a9413d7367 fix(uri): make absolute-form uris always have a path 2018-02-08 16:14:02 -08:00
Sean McArthur
8e57338ef0 v0.11.18 2018-02-07 13:59:47 -08:00
Sean McArthur
88f01793be fix(client): send an Error::Cancel if a queued request is dropped
Adds `Error::Cancel` variant.
2018-02-07 13:12:33 -08:00
Sean McArthur
a821a366f1 chore(h1): remove accidental BufDeque::bytes code 2018-02-06 16:14:09 -08:00
Sean McArthur
b0aa649725 feat(client): add http1_writev configuration option
Setting this to false will force HTTP/1 connections to always flatten
all buffers (headers and body) before writing to the transport. The
default is true.
2018-02-06 14:53:21 -08:00
Sean McArthur
d2fdf1f525 perf(h1): convert buffer to flatten strategy with auto detection 2018-02-06 14:35:47 -08:00
Sean McArthur
3a124462c6 test(h1): fix flaky streaming test 2018-02-06 13:25:10 -08:00
Sean McArthur
648548cfa3 test(client): add benchmarks for new cancelable queue 2018-02-06 12:31:31 -08:00
Sean McArthur
1eb18a9e44 v0.11.17 2018-02-05 16:37:43 -08:00
Sean McArthur
731096947d fix(h1): fix hung streaming bodies over HTTPS 2018-02-05 16:33:23 -08:00
Sean McArthur
0c290c32c9 refactor(h1): reduce noisy read_mem logs 2018-02-05 11:53:49 -08:00
Sean McArthur
b7293ca6ff refactor(client): clean up pool Checkout::poll function 2018-02-05 11:53:17 -08:00
Sean McArthur
265ad67c86 fix(client): more reliably detect closed pooled connections (#1434) 2018-02-05 09:56:29 -08:00
Sean McArthur
8fb84d29a1 refactor(server): add private constructor to AddrIncoming and AddrSteram 2018-02-01 12:41:58 -08:00