Douman
ec69c4282c
Introduce Request::timeout to override agent's config
2021-02-27 10:59:54 +01:00
trevyn
1e5307cbca
Fix typo: "patform" -> "platform" ( #332 )
2021-02-22 10:34:46 -08:00
Jacob Hoffman-Andrews
b80f12e384
Offer separate error during handshakes. ( #331 )
...
It's useful to know that an error was specific to the TLS handshake,
versus the TCP connect, or a later stage of a request.
2021-02-21 14:26:25 -08:00
Jacob Hoffman-Andrews
6f86ee7f93
Add example "cureq". ( #330 )
...
Contrary to smoke-test, this takes full URLs on the commandline and
prints their contents to stdout. This makes it easier to test behavior
with specific URLs. I hope to later add flags for various behaviors like
printing headers, following redirects, enabling / disabling cookies,
and verbose output.
Also add a useful debug line when receiving a cookie header.
2021-02-21 14:26:12 -08:00
Martin Algesten and Jacob Hoffman-Andrews
7222931b24
Update src/response.rs
...
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com >
2021-02-21 23:20:58 +01:00
Martin Algesten
ea83edc609
Allow status lines with missing reason phrase
...
The spec says the reason phrase at least must be a space. However in
the wild, there are sites that just ends after the status code.
To be more compatible, this commit relaxes ureq's parsing.
Close #316
2021-02-21 23:20:58 +01:00
Martin Algesten and Jacob Hoffman-Andrews
dc0069670d
Update src/response.rs
...
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com >
2021-02-21 23:20:20 +01:00
Martin Algesten
281a8462b5
Clarify doc
...
Close #326
2021-02-21 23:20:20 +01:00
Jacob Hoffman-Andrews
413e8bf4aa
Fix imports
2021-02-21 13:32:42 -08:00
Jacob Hoffman-Andrews
671f24ab49
Offer separate error during handshakes.
...
It's useful to know that an error was specific to the TLS handshake,
versus the TCP connect, or a later stage of a request.
2021-02-21 13:20:38 -08:00
Martin Algesten
c833acfe5c
2.0.2
2021-02-21 09:30:57 +01:00
Martin Algesten
d76c0e7910
Update changelog for 2.0.2
2021-02-21 09:28:50 +01:00
Nicolas
1857061859
Add a test case for LF line ending response headers
2021-02-21 09:21:18 +01:00
Nicolas
a73ff2e465
Fix #321 : LF header line ending
2021-02-21 09:21:10 +01:00
Jacob Hoffman-Andrews
e411a629bd
Changelog for 2.0.2
2021-02-21 09:00:33 +01:00
Jacob Hoffman-Andrews
b246f0a9d2
Apply deadline across redirects. ( #313 )
...
Previously, each redirect could take timeout time, so a series of slow
redirects could run for longer than expected, or indefinitely.
2021-02-07 12:29:35 -08:00
Martin Algesten
d627ef9704
OrAnyStatus::or_any_status ergonomic helper
...
Some users might prefer to handle all HTTP responses as Response
regardless of status code.
2021-01-30 09:40:45 +01:00
Michael Diamond
0c467fee13
Add a user_agent() method to AgentBuilder to configure the default User-Agent header. ( #311 )
2021-01-29 17:23:30 -08:00
Jacob Hoffman-Andrews
5999421d84
Check cargo fmt in CI.
2021-01-17 21:56:28 +01:00
Martin Algesten
06abdff4bf
cargo fmt ( #303 )
2021-01-17 11:07:52 -08:00
Jarobi
4aadda8ad3
Fix typo in doc of into_json
2021-01-17 13:51:19 +01:00
Jacob Hoffman-Andrews
0b5db55378
Bump to 2.0.1. ( #289 )
...
Update CHANGELOG.md and Cargo.toml
2021-01-10 13:34:45 -08:00
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
Martin Algesten
948f736125
Document proxy support ( #298 )
...
ureq supports proxying using HTTP CONNECT and SOCKS5, the features are however
missing documentation. This brings it to the lib.rs doc.
2021-01-09 09:58:07 -08:00
Martin Algesten
c24b250c80
Implement std::error::Error for error::Transport ( #299 )
...
Close #294
2021-01-09 09:56:20 -08:00
Joshua Nelson
d0bd2d5ea9
Use iteration instead of recursion for connect ( #291 )
...
This allows handling larger redirect chains.
Fixes #290
2021-01-05 13:55:26 -08:00
Ulrik
0ee024f8c2
Response: Use ErrorKind::UnexpectedEof for "premature close"
2021-01-05 12:07:11 +01:00
Joshua Nelson
f0245aad23
Fix some clippy lints ( #292 )
...
This commit can be replicated with `cargo +nightly clippy --fix -Z unstable-options`,
plus an edit to fix another `return` missed by clippy.
2021-01-03 20:10:43 -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
Joshua Nelson
aeeff40c95
Fix 307/308 redirects (again)
...
- Add unit test
- Use the original method instead of hard-coding GET
2021-01-03 20:31:00 -05:00
Joshua Nelson
498b7137c2
Make tests much easier to debug
...
- Don't panic on the mutex in all tests if a single test fails
- Give a more helpful message if a test handler wasn't registered
- Enable env_logger for tests
2021-01-03 20:26:17 -05:00
Martin Algesten
6da035b669
Update CHANGELOG.md
...
Change 2.0.0-rc2 => 2.0.0
2021-01-03 21:22:40 +01:00
Jacob Hoffman-Andrews
6390558415
Update CHANGELOG for 2.0.0.
2021-01-03 21:07:09 +01:00
Martin Algesten
8f9f3e5827
Fix main lib.rs and README.md example ( #284 )
...
Small fixes to just ensure lib.rs and README.md are run via cargo readme.
2021-01-03 10:38:10 -08:00
robviren
7ffaa8cf9a
Minor changes to simple example to get rid of warnings and error.
2021-01-02 16:26:33 +01:00
Martin Algesten
1f0d84279a
Document simplest error example
2020-12-27 23:47:43 +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