Commit Graph
100 Commits
Author SHA1 Message Date
Jacob Hoffman-Andrews 1584690c95 Update CHANGELOG. 2021-01-10 13:28:07 -08:00
Jacob Hoffman-Andrews fff4c8355e Merge branch 'main' of github.com:algesten/ureq into changelog-2.0.1 2021-01-10 13:26:54 -08:00
Jacob Hoffman-Andrews 932c180d1d Response: Use ErrorKind::UnexpectedEof for "premature close" (#293)
In a client application, we're explicitly trying to differentiate "invalid data"
scenarios from "broken transfer".
2021-01-10 13:25:42 -08:00
Jacob Hoffman-Andrews 96985956aa Bump to 2.0.1.
Brings in a fix to 308 redirects.
2021-01-03 17:52:38 -08:00
Jacob Hoffman-Andrews 6126a2fe50 Merge pull request #288 from jyn514/308
Fix 307/308 redirects (again, for 2.0).

Also add some improvements to registration of test handlers, and add env_logger support to tests.
2021-01-03 17:45:05 -08:00
Jacob Hoffman-Andrews 6390558415 Update CHANGELOG for 2.0.0. 2021-01-03 21:07:09 +01:00
Jacob Hoffman-Andrews 234eb5572f Update CHANGELOG and Cargo.toml for 2.0.0-rc4 (#279) 2020-12-19 12:11:38 -08:00
Jacob Hoffman-Andrews de1805190e Do more validation on status line. (#266)
Status code must be exactly three digits.
HTTP version must be "HTTP/", digit, dot, digit.

https://tools.ietf.org/html/rfc7230#section-3.1.2
status-line = HTTP-version SP status-code SP reason-phrase CRLF
2020-12-18 22:18:25 -08:00
Jacob Hoffman-Andrews 243b987110 Remove error_on_non_2xx. (#272)
After the recent changes in #257, it's probably not necessary. It's now
quite easy to use a match statement to extract responses for certain
status codes, or all status codes.

Add documentation on how to turn a status code error back into a
Response.
2020-12-18 22:10:55 -08:00
Jacob Hoffman-Andrews e25a6876f9 Document error handling. 2020-12-18 22:04:00 -08:00
Jacob Hoffman-Andrews 8cb4f401e3 Add history to response objects (#275)
This allows Error to report both the URL that caused an error, and the
original URL that was requested.

Change unit::connect to use the Response history for tracking number of
redirects, instead of passing the count as a separate parameter.

Incidentally, move handling of the `stream` fully inside `Response`.
Instead of `do_from_read` + `set_stream`, we now have `do_from_stream`,
which takes ownership of the stream and keeps it. We also have
`do_from_request`, which does all of `do_from_stream`, but also sets the
`previous` field.
2020-12-13 11:59:11 -08:00
Jacob Hoffman-Andrews 10baf7c051 Clarify example from README. (#277)
We should include the `fn main() -> Result` part, because people may not
know they need the `-> Result` in order for `?` to work.

Also, I replaced `Accept: text/html` with `Example-Header: header
value`. My thinking is that if someone doesn't know they need to remove
that Accept for non-HTML URLs, they might get unexpected results.
2020-12-12 10:33:30 -08:00
Jacob Hoffman-Andrews 1448969dd7 Increment version to 2.0.0-rc3 2020-12-12 09:27:50 -08:00
Jacob Hoffman-Andrews f8e0e15376 Changelog for 2.0.0-rc3 (#273) 2020-12-12 09:26:53 -08:00
Jacob Hoffman-Andrews 60d4967a16 Remove changelog entry about error_on_non_2xx 2020-12-12 09:25:38 -08:00
Jacob Hoffman-Andrews b9e3d3e76c Fix test 2020-12-06 14:55:55 -08:00
Jacob Hoffman-Andrews ac93fa7e18 Remove references to error_on_non_2xx 2020-12-05 20:32:30 -08:00
Jacob Hoffman-Andrews 06760d5961 Changelog for 2.0.0-rc3 2020-12-05 14:10:21 -08:00
Jacob Hoffman-Andrews 9e270c77e8 Remove error_on_non_2xx.
After the recent changes in #257, it's probably not necessary. It's now
quite easy to use a match statement to extract responses for certain
status codes, or all status codes.
2020-12-05 14:05:15 -08:00
Jacob Hoffman-Andrews ec04eef7bc Fix up error docs. (#270) 2020-12-05 13:15:33 -08:00
Jacob Hoffman-Andrews 6c9378ce37 De-redundantize Error kinds. (#259)
Change "Bad" to "Invalid" in error names, mimicking io::Error::ErrorKind.

Change InvalidProxyCreds to ProxyUnauthorized.

Change DnsFailed to just Dns (the fact that there was a failure is implicit
in the fact that this was an error).
2020-12-05 12:05:29 -08:00
Jacob Hoffman-Andrews 57f251d766 Remove Response::status_line. (#263)
The necessary functionality is available via status_text, and removing
this method means we have more flexibility in our internal storage.
2020-12-05 12:01:56 -08:00
Jacob Hoffman-Andrews c3a6f50dbe Remove status methods on Response. (#258)
Now that Responses with non-2xx statuses get turned into `Error`,
there is less need for these. Also, surveying the set of public crates
that depend on ureq, none of them use these methods. It seems that
users tend to prefer checking the status code directly.

Here is my thinking on each of these individually:

.ok() -- With the new Result API, any Request you get back will be
.ok(). Also, I think the name .ok() is a little confusing with
Result::ok().

.error() - with the new Result API, this is an exact overlap with
anything that would return Error. People will just check for whether a
Result is Err(...) rather than call .error().

.client_error() - most of the time, if someone wants to specially handle
a 4xx error, they want to handle specific ones, because the response to
them is different. For instance a specialized response to a 404 would be
"delete this from the list of URLs to check in the future," where a
specialized response to a 401 would be "try and load updated
credentials." For instance:

https://github.com/msfjarvis/healthchecks-rs/blob/4200edb9ed73bed56a05d81cdd3b0a65badc7ede/healthchecks/src/manage.rs#L70-L84

https://github.com/SirWindfield/cargo-free/blob/75d4b363b63fa2b6f3ac12a196a2cb80f0afc848/src/lib.rs#L59-L63

https://github.com/lukehsiao/netlify-ddns-rs/blob/1d7daea38bf78d9f1bbfba9d38ea1863ed70ed1d/src/netlify.rs#L101-L112

.server_error() - I don't have as much objection to this one, since it's
reasonable to want to treat all server errors (500, 502, 503) more or
less the same. Although even at that, 501 Not Implemented seems like
people would want to handle it differently. I guess that doesn't come up
much in practice - I've never seen a 501 in the wild.

.redirect() - Usually redirects are handled under the hood, unless
someone disables automatic redirect handling. I'm not terribly opposed
to this one, but given that no-one's using it and it's just as easy to
do 300..399.contains(resp.status()), I'm mildly inclined towards
deletion.
2020-12-05 11:32:25 -08:00
Jacob Hoffman-Andrews be6be7e600 Fix test 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 18a9b08973 Revert deletions of client_error and friends. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 64ebd47979 Add nicer doctest; revert smoke-test. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 5a55f94101 Improve smoke-test.rs 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 814b10ceaf Update smoke-test. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 219185f73f Make Error an enum again. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews b20c4fc3be Revert diff 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 3cd160279f Revert diff 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews f9378ab089 Replace Error::status and Error::into_response with http. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews d267dffde1 Snapshow of match variant. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 33066fb074 Improve doctest comments. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 2167cf2481 Interlink docs 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 71a7e3298d Add documentation for handling statuses. 2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 4c3b93d86d Add Error::{kind, status, into_response}.
Also, remove Response::{ok, error, client_error, server_error,
redirect}. The idea is that you would access these through the
Error object instead.

I fetched all the reverse dependencies of ureq on crates.io and looked
for uses of the methods being removed. I found none.

I'm also considering removing the error_on_non_2xx method entirely. If
it's easy to get the underlying response for errors, it would be nice to
make that the single way to do things rather than support two separate
ways of handling HTTP errors.
2020-12-05 15:29:11 +01:00
Jacob Hoffman-Andrews 35c03521b9 Add debug logs for stream pooling. 2020-12-05 15:05:20 +01:00
Jacob Hoffman-Andrews 7afc4b04f3 Use BufRead in more places (#261)
This moves Stream's enum into an `Inner` enum, and wraps a single
BufReader around the whole thing. This makes it easier to consistently
treat the contents of Stream as being wrapped in a BufReader.

Also, implement BufRead for DeadlineStream. This means when a timeout
is set, we don't have to set that timeout on the socket with every
small read, just when we fill up the buffer. This reduces the number
of syscalls.

Remove the `Cursor` variant from Stream. It was strictly less powerful
than that `Test` variant, so I've replaced the handful of Cursor uses
with `Test`. Because some of those cases weren't test, I removed the
`#[cfg(test)]` param on the `Test` variant.

Now that all inputs to `do_from_read` are `impl BufRead`, add that
as a type constraint. Change `read_next_line` to take advantage of
`BufRead::read_line`, which may be somewhat faster (though I haven't
benchmarked).
2020-11-30 09:23:19 -08:00
Jacob Hoffman-Andrews 36b307423c Fix non-tls case correctly. 2020-11-29 00:02:37 -08:00
Jacob Hoffman-Andrews 6b6a59f215 Fix non-tls case. 2020-11-28 23:57:02 -08:00
Jacob Hoffman-Andrews a286a7a22d Make DeadlineStream Read use the BufRead. 2020-11-28 23:33:28 -08:00
Jacob Hoffman-Andrews 6a22c54ba2 Small cleanups. 2020-11-28 22:34:32 -08:00
Jacob Hoffman-Andrews 50cb5cecd1 Fix buffered DeadlineStream 2020-11-28 17:47:17 -08:00
Jacob Hoffman-Andrews 131a0264d1 Move BufReader up the stack in Stream.
Stream now has an `Inner` enum, and wraps an instance of that enum in a
BufReader. This allows Stream itself to implement BufRead trivially, and
simplify some of the match dispatching. Having Stream implement BufRead
means we can make use of `read_line` instead of our own `read_next_line`
(not done in this PR yet).

Also, removes the `Cursor` variant of the Inner enum in favor of using
the `Test` variant everywhere, since it's strictly more powerful.
2020-11-28 12:04:28 -08:00
Jacob Hoffman-Andrews a0b88926fa Remove a keyword from Cargo.toml. (#250)
Crates has a max of 5 keywords.
2020-11-23 00:02:01 -08:00
Jacob Hoffman-Andrews f944764ee0 Merge pull request #249 from jsha/merge-master-into-release-2.0a
Merge master into release 2.0a
2020-11-22 23:47:02 -08:00
Jacob Hoffman-Andrews 0e5cb2d018 Merge branch 'master' into merge-master-into-release-2.0a 2020-11-22 23:38:53 -08:00
Jacob Hoffman-Andrews 3d0cb33596 Add URL to Error in non-2xx case. (#243) 2020-11-22 23:36:45 -08:00
Jacob Hoffman-Andrews de4aab7472 Tweak CHANGELOG a little bit. (#242)
Mention cloning Agent, default timeout, and removal of Request::build.
2020-11-22 23:36:25 -08:00
Jacob Hoffman-Andrews 61a6d1c5b1 Remove commented-out timeout_during_headers test. (#244)
We wound up with a second, working copy of this test at some point after
merging master into release-2.0.
2020-11-22 23:36:05 -08:00
Jacob Hoffman-Andrews 1ec8674e88 Merge pull request #241 from jsha/changelog-2.0
Update CHANGELOG, Cargo.toml, and docs for 2.0.
2020-11-22 13:27:01 -08:00
Jacob Hoffman-Andrews feec10b0a7 Merge pull request #240 from jsha/merge-master-into-release-2.0
Merge master into release 2.0
2020-11-22 13:26:29 -08:00
Jacob Hoffman-Andrews c915b236ae Fix is_connection_closed. (#238)
Fixes #237.
2020-11-22 12:56:58 -08:00
Jacob Hoffman-Andrews cc7ce757bd Update CHANGELOG, Cargo.toml, and docs for 2.0. 2020-11-22 11:09:32 -08:00
Jacob Hoffman-Andrews 1c41da87f0 Merge branch 'master' into merge-master-into-release-2.0 2020-11-22 10:25:13 -08:00
Jacob Hoffman-Andrews 96f6ed15d7 Remove "what" section of test matrix. (#239)
We were generating two whole sets of jobs, for --tests and --docs
separately. But the default invocation of cargo runs both tests and
doctests. We can save some resources and speed up our test runs by
allowing cargo to do both in one invocation.
2020-11-22 00:23:59 -08:00
Jacob Hoffman-Andrews 6a7b064f2a Remove Headers from the public API. (#224)
It turns out Headers is actually an internal-only API. None of the
user-facing types use it.

Unfortunately, making it unexported also required deleting the doctests,
since doctests can only run against a public interface.
2020-11-22 00:15:13 -08:00
Jacob Hoffman-Andrews 213d64086c Merge into_json_deserialize into into_json. (#235)
Followup to #56. At the time, doing this would have been an API
break; but we can do this as part of 2.0. This simplifies the API
nicely and creates better symmetry between sending bodies and
receiving them.
2020-11-21 22:19:13 -08:00
Jacob Hoffman-Andrews 2136f00bef Make Error Send + Sync (#236) 2020-11-21 22:11:35 -08:00
Jacob Hoffman-Andrews e92bf0b4bb Add ureq::request_url and Agent::request_url. (#226)
These let a user pass an already-parsed Url.
2020-11-21 22:11:15 -08:00
Jacob Hoffman-Andrews 0321ea043d Add some short docstrings for types. (#225)
These types were missing a short docstring, leaving the comment space to
their right blank on the crate page.

Also, this takes advantage of intra-rustdoc links to link terms:
https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md
2020-11-21 22:10:37 -08:00
Jacob Hoffman-Andrews 420c3e2483 Merge branch 'release-2.0' into json_deserialize 2020-11-21 16:25:14 -08:00
Jacob Hoffman-Andrews fade03b54e Rewrite the Error type. (#234)
This adds a source field to keep track of upstream errors and allow
backtraces, plus a URL field to indicate what URL an error was
associated with.

The enum variants we used to use for Error are now part of a new
ErrorKind type. For convenience within ureq, ErrorKinds can be turned
into an Error with `.new()` or `.msg("some additional information")`.

Error acts as a builder, so additional information can be added after
initial construction. For instance, we return a DnsFailed error when
name resolution fails. When that error bubbles up to Request's
`do_call`, Request adds the URL.

Fixes #232.
2020-11-21 16:14:44 -08:00
Jacob Hoffman-Andrews 271e650662 Merge into_json_deserialize into into_json. 2020-11-21 15:47:49 -08:00
Jacob Hoffman-Andrews dac517e30e Update README and docs. (#233)
This makes src/lib.rs the primary source for crate-level documentation.
I've generated README.md with `cargo readme > README.md`. Since links to
specific documentation items should be relative when possible, but must
be absolute in README.md, I've used the new syntax for intra-rustdoc
links
(https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md),
along with a README.tpl that sets up those links to point at the
absolute versions. `cargo readme` uses the README.tpl by default.

I've also rewritten the crate level docs, removing some TODO information
at the bottom, and moving the license information to CONTRIBUTING.md.
2020-11-21 09:40:04 -08:00
Jacob Hoffman-Andrews 4fe37260a4 Update README 2020-11-19 21:38:45 -08:00
Jacob Hoffman-Andrews c891aa31e5 Tweak sentence. 2020-11-19 21:36:23 -08:00
Jacob Hoffman-Andrews cc72fdfca8 Add section on async 2020-11-19 21:31:23 -08:00
Jacob Hoffman-Andrews a300ccdaad Update README and docs.
This makes src/lib.rs the primary source for crate-level documentation.
I've generated README.md with `cargo readme > README.md`. Since links to
specific documentation items should be relative when possible, but must
be absolute in README.md, I've used the new syntax for intra-rustdoc
links
(https://github.com/rust-lang/rfcs/blob/master/text/1946-intra-rustdoc-links.md),
along with a README.tpl that sets up those links to point at the
absolute versions. `cargo readme` uses the README.tpl by default.

I've also rewritten the crate level docs, removing some TODO information
at the bottom, and moving the license information to CONTRIBUTING.md.
2020-11-15 22:58:02 -08:00
Jacob Hoffman-Andrews 4cb856196e Rename some call sites for read_headers.
Fixes tests.
2020-11-15 22:35:42 +01:00
Jacob Hoffman-Andrews 26145810bf Add some more updates. 2020-11-15 09:14:19 +01:00
Jacob Hoffman-Andrews daa63d3bc6 Update some more doctests.
I missed these in my previous doctest PR.

The doctests all now run without accessing the network. Tested by
turning off networking and running them.

Request.call's doctest wouldn't run because it relied on making a custom
AgentBuilder and building it, which bypasses the test_agent. I concluded
that this doctest was mostly illustrating behavior of AgentBuilder, not
call(), and simplified it to be more like the other calling methods on
request.
2020-11-15 09:14:19 +01:00
Jacob Hoffman-Andrews 203573d27c Implement more realistic doctests. (#222)
Add is_test and fn main headers to various doctests, and use real
URLs along with the ? operator.
2020-11-14 09:53:15 -08:00
Jacob Hoffman-Andrews ec8dace1af Turn Unit into a built Request (#223)
This involved removing the Request reference from Unit, and adding an
Agent, a method, and headers.

Also, move is_retryable to Unit.
2020-11-14 01:12:01 -08:00
Jacob Hoffman-Andrews acc36ac370 Add support for using testserver in doctests. (#218)
Doctests run against a normally-built copy of the crate, i.e. one
without #[cfg(test)] set, so we can't use the conditional compilation
feature.

Instead, define a static var that indicates whether the library is
running in test mode or not. For each doctest, insert a hidden call that
sets this var to true. Then, when ureq::agent() is called, it returns a
test_agent instead.

This required moving testserver out of the test mod and into src/, so
that it can be included unconditionally (i.e. when cfg(test) is false).

This PR converts one doctest as an example. If we land this PR, I'll
send a followup to convert the rest.
2020-11-13 10:40:16 -08:00
Jacob Hoffman-Andrews a0b901f35b Remove qstring dependency. (#221)
Instead, rely on Url's built-in query parameter handling. A Request now
accumulates a list of query param pairs, and joins them with a parsed
URL at the time do_call is called.

In the process, remove some getters that rely on parsing the URL.
Adapting these getters was going to be awkward, and they mostly
duplicate things people can readily get by parsing the URL.
2020-11-13 00:02:52 -08:00
Jacob Hoffman-Andrews 920eccf37a Remove proxy method on request (#220) 2020-11-12 23:25:05 -08:00
Jacob Hoffman-Andrews c2d4e527a9 1.5.1 2020-11-08 20:58:11 -08:00
Jacob Hoffman-Andrews 310c14d601 Update CHANGELOG for 1.5.2. (#216) 2020-11-08 20:40:09 -08:00
Jacob Hoffman-Andrews d6f31ebb52 Remove some dev-dependencies. (#200)
We don't really need rayon for the parallelism in smoke-test.

Also, now that we use log, smoke-test can just use that.
2020-11-08 11:54:25 -08:00
Jacob Hoffman-Andrews d83de53bcd Restore HEAD and DELETE
Also, remove OPTIONS, TRACE, and PATCH from lib.rs.
2020-10-30 05:49:01 +01:00
Jacob Hoffman-Andrews aae05c5614 Agent tweaks for 2.0
Replace `this` idiom with `mut self`.

Move idle connections constants from pool.rs to agent.rs.

Remove Agent.set and some convenience request methods
(leaving get, post, and put).

Move max_idle_connections setting from AgentConfig to AgentBuilder
(since the builder passes these to ConnectionPool and the Agent
doesn't subsequently need them).

Eliminate duplicate copy of proxy in AgentState; use the one in
AgentConfig.
2020-10-30 05:49:01 +01:00
Jacob Hoffman-Andrews e3bf7c73f3 Replace serde_macros.rs with pub use. (#212) 2020-10-29 09:43:02 -07:00
Jacob Hoffman-Andrews 9484d86584 Merge branch 'release-2.0' into rm-rayon 2020-10-29 00:18:43 -07:00
Jacob Hoffman-Andrews 73af61132e Merge branch 'master' into release-2.0 2020-10-28 23:00:01 -07:00
Jacob Hoffman-Andrews 4a304fe937 Merge pull request #206 from jsha/merge-master-into-release-2.0
Merge master into release 2.0
2020-10-25 16:46:32 -07:00
Jacob Hoffman-Andrews 6781122b46 Merge pull request #205 from steffahn/generalize_send_reader_lifetime
Make Request::send more general.
2020-10-25 16:46:13 -07:00
Jacob Hoffman-Andrews 632825314c Merge pull request #207 from jsha/import-paths-tweaks
Tweak import paths
2020-10-25 16:45:36 -07:00
Jacob Hoffman-Andrews 17ab5110a3 Use lifetimes for more elements of Payload
Text and Bytes can both have their lifetimes parameterized.
2020-10-25 15:52:02 -07:00
Jacob Hoffman-Andrews 72e7e06334 Tweak import paths
Group together all cookie imports in agent.rs; consistently use `Duration`.
2020-10-25 15:10:03 -07:00
Jacob Hoffman-Andrews a52c6021cf Merge branch 'master' into release-2.0 2020-10-25 14:07:32 -07:00
Jacob Hoffman-Andrews 0cfa06c80c API changes for 2.0 (#201)
* Remove Request::build
* All mutations on Request follow builder pattern

The previous `build()` on request was necessary because mutating
functions did not follow a proper builder pattern (taking `&mut self`
instead of `mut self`). With a proper builder pattern, the need for
`.build()` goes away.

* All Request body and call methods consume self

Anything which "executes" the request will now consume the `Request`
to produce a `Result<Response>`.

* Move all config from request to agent builder

Timeouts, redirect config, proxy settings and TLS config are now on
`AgentBuilder`.

* Rename max_pool_connections -> max_idle_connections
* Rename max_pool_connections_per_host ->  max_idle_connections_per_host

Consistent internal and external naming.

* Introduce new AgentConfig for static config created by builder.

`Agent` can be seen as having two parts. Static config and a mutable
shared state between all states. The static config goes into
`AgentConfig` and the mutable shared state into `AgentState`.

* Replace all use of `Default` for `new`.

Deriving or implementing `Default` makes for a secondary instantiation
API.  It is useful in some cases, but gets very confusing when there
is both `new` _and_ a `Default`. It's especially devious for derived
values where a reasonable default is not `0`, `false` or `None`.

* Remove feature native_tls, we want only native rustls.

This feature made for very clunky handling throughout the code. From a
security point of view, it's better to stick with one single TLS API.
Rustls recently got an official audit (very positive).

https://github.com/ctz/rustls/tree/master/audit

Rustls deliberately omits support for older, insecure TLS such as TLS
1.1 or RC4. This might be a problem for a user of ureq, but on balance
not considered important enough to keep native_tls.

* Remove auth and support for basic auth.

The API just wasn't enough. A future reintroduction should at least
also provide a `Bearer` mechanism and possibly more.

* Rename jar -> cookie_store
* Rename jar -> cookie_tin

Just make some field names sync up with the type.

* Drop "cookies" as default feature

The need for handling cookies is probably rare, let's not enable it by
default.

* Change all feature checks for "cookie" to "cookies"

The outward facing feature is "cookies" and I think it's better form
that the code uses the official feature name instead of the optional
library "cookies".

* Keep `set` on Agent level as well as AgentBuilder.

The idea is that an auth exchange might result in a header that need
to be set _after_ the agent has been built.

* Change ordering on TestServer's atomic bool to SeqCst
2020-10-25 11:40:10 -07:00
Jacob Hoffman-Andrews 304981377b Restore serde dev_dependency. 2020-10-24 10:04:55 -07:00
Jacob Hoffman-Andrews 22e3839340 Review feedback. 2020-10-24 12:12:07 +02:00
Jacob Hoffman-Andrews 2bf9362eff Reinstate read timeouts on body.
This feature was broken in #67, which reset timeouts on the
stream before passing it to set_stream.

As part of this change, refactor the internal storage of
timeouts on the Request object to use Option<Duration>.

Remove the deadline field on Response. It wasn't used. The
deadline field on unit was used instead.

Add a unittest.
2020-10-24 12:12:07 +02:00
Jacob Hoffman-Andrews 32f9ebc04a Separate overall_timeout checks. 2020-10-24 12:08:27 +02:00
Jacob Hoffman-Andrews 1f5f65877a Update overall_timeout_during_headers test. 2020-10-24 12:08:27 +02:00
Jacob Hoffman-Andrews 14475cb5c7 Add test for read_timeout during headers. 2020-10-24 12:08:27 +02:00
Jacob Hoffman-Andrews 67c28d28a3 Check for synthetic_error early in unit::connect 2020-10-24 12:08:27 +02:00