Commit Graph

434 Commits

Author SHA1 Message Date
Martin Algesten
87cf59d399 Doc fix 2021-12-22 07:58:45 +01:00
Martin Algesten
98ac6313e5 Agent/AgentBuilder impl Debug manually 2021-12-22 07:58:45 +01:00
Jacob Hoffman-Andrews
352bf19f40 Fix doctests 2021-12-20 09:19:25 +01:00
Jacob Hoffman-Andrews
2df70168c4 Use ? instead of unwrap in examples (#458)
This is recommended by the Rust API Guidelines:

https://rust-lang.github.io/api-guidelines/documentation.html#examples-use--not-try-not-unwrap-c-question-mark

One exception: When we need to unwrap an Option, the examples still use
.unwrap(). The alternative would be something like
`.ok_or(SomeErrorHere)?`, which feels like an awkward way to deal with
an Option. This might get better with NoneError:

https://docs.rs/rustc-std-workspace-std/1.0.1/std/option/struct.NoneError.html

I also rearranged some examples that used turbofish to use type
annotations. I think type annotations are more familiar to early Rust
users (and they use fewer characters and less punctuation, which is
always nice).
2021-12-19 20:04:30 -08:00
Martin Algesten
738cb84aec Enable 'gzip' by default 2021-12-20 02:38:18 +01:00
Martin Algesten
4aa5480543 Improve doc after review 2021-12-19 21:17:26 +01:00
Martin Algesten
8f476e9d29 cargo fmt 2021-12-19 21:17:26 +01:00
Martin Algesten
75f6be8ff8 Format error message like suggested in review 2021-12-19 21:17:26 +01:00
Martin Algesten
d1a2c630f5 Update src/rtls.rs
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2021-12-19 21:17:26 +01:00
Martin Algesten
324c5c074f Update src/error.rs
Co-authored-by: Jacob Hoffman-Andrews <github@hoffman-andrews.com>
2021-12-19 21:17:26 +01:00
Martin Algesten
f3857eed00 Ensure we provide a Transport::message() when we can 2021-12-19 21:17:26 +01:00
Martin Algesten
6a094db668 Provide access methods for error::Transport
.message() and .kind() so that the user can get the details of a transport
error. This also documents the motivation for the different fields
2021-12-19 21:17:26 +01:00
Martin Algesten
158a6c6f03 Clarify serde doc on Response::into_json (#451)
Close #428
2021-12-19 11:41:44 -08:00
Malloc Voidstar
598ebf4393 Remove Content-Encoding and length when decompressing
This should lower the chance of breakage. Probably also more proper for a client library.
2021-12-19 14:01:56 +01:00
Malloc Voidstar
6281a0bea6 Add tests for automatic decompression 2021-12-19 14:01:56 +01:00
Malloc Voidstar
9a070fb1ad And to lib.rs, woops 2021-12-19 14:01:56 +01:00
Malloc Voidstar
23e993689a Rename Decompressor to BrotliDecoder to align with gzip 2021-12-19 14:01:56 +01:00
Malloc Voidstar
873e6066f3 Add support for gzip and brotli
Automatically sends the Accept-Encoding header on requests.

Not runtime-configurable, only with Cargo features.
2021-12-19 14:01:56 +01:00
Martin Algesten
0f0dec5f32 Fixes after feedback 2021-12-19 11:00:39 +01:00
Martin Algesten
2b0eca9827 Move auth header on redirect to unit construction
The auth header stripping was in the wrong place (when serializing the request),
rather than in the construction of the Unit, where it ought to be.

This also makes redirect header retention testable.
2021-12-19 11:00:39 +01:00
Martin Algesten
f941717a5d Mark RedirectAuthHeaders as non_exhaustive 2021-12-19 11:00:39 +01:00
Martin Algesten
27533cf31b Use match expression against RedirectAuthHeaders to ensure exhaustive 2021-12-19 11:00:39 +01:00
Martin Algesten
c59632bd97 Use Url (instead of String) in internal history var 2021-12-19 11:00:39 +01:00
Martin Algesten
2a5ab43c8c Expose RedirectAuthHeaders enum at crate root 2021-12-19 11:00:39 +01:00
Martin Algesten
8d33318a23 Rename setter to be consistent with other builder settter 2021-12-19 11:00:39 +01:00
Martin Algesten
b033e0f614 Doc fixes to RedirectAuthHeaders 2021-12-19 11:00:39 +01:00
llde
26a3715f62 Revert move of variable 2021-12-19 11:00:39 +01:00
llde
653f791638 Create new configuration option for redirect preserving authorization header in Agent. Handle new option in Unit 2021-12-19 11:00:39 +01:00
llde
38ad90307d Preserve Authorization in same host redirects, when scheme and port are equals 2021-12-19 11:00:39 +01:00
soruh
61e2402045 deprecate using SerdeValue, SerdeMap and serde_to_value
as they are just wrapper around serde_json::{Value, Map, to_value}.
Instead expose the serde_json and serde crates used.
2021-12-17 20:12:07 +01:00
soruh
59f1fab4d3 allow send_json to send any serde::Serialize value 2021-12-17 20:12:07 +01:00
Jacob Hoffman-Andrews
56276c3742 Add support for alternate TLs implementations. 2021-12-17 17:47:30 +01:00
Malloc Voidstar
1c1dfaa691 Bump rustls to 0.20.1; add src to rustls error (#438) 2021-12-17 00:32:00 -08:00
Martin Algesten
a6d1750f14 Fix native-certs and add to test matrix
Close #239
2021-11-28 22:45:16 +01:00
Jochen Kupperschmidt
69ad3aabb0 Add shortcuts for PATCH (again)` 2021-11-26 13:50:29 +01:00
Malloc Voidstar
31dd67380e Return error for InvalidDnsNameError, don't panic (#436)
Can't provide src for the error as rustls 0.20 didn't implement stdlib Error for it; it's on main and targeted for 0.20.1.
2021-11-12 17:15:39 -08:00
Jacob Hoffman-Andrews
f22e67be4c Fix agent test. 2021-10-21 07:38:59 +02:00
Jacob Hoffman-Andrews
3bc7d8336b Fix lint 2021-10-21 07:38:59 +02:00
Jacob Hoffman-Andrews
5fa912c4d3 Update to rustls 0.20, webpki 0.22 2021-10-21 07:38:59 +02:00
Andrew Hickman
eb78813df5 Redact sensitive headers when logging prelude (#415)
Closes #414
2021-10-05 08:57:16 -07:00
Jon Gjengset
1ec60e1c15 Remove trailing newline from testing response
The newline becomes part of the response body, even though it was not passed in
as `body`, which makes `Response::new` difficult to use with anything that
checksums data contents for example. Arguably there should also be a mechanism
for passing in `[u8]` bodies, but that's for a separate feature request.
2021-10-02 18:51:59 +02:00
Jacob Hoffman-Andrews
535bc4b4cb Remove two unused fields. (#425)
Co-authored-by: Michael Richardson <mcr@sandelman.ca>
2021-10-02 01:04:36 -07:00
Martin Algesten
551f4289fb Update all dependencies
webpki and webpki roots are not compatible with current rustls,
so they are held back.:wq
2021-08-23 21:21:39 +02:00
Martin Algesten
485647d5de Fix proxy urls that end with trailing slash
Close #402
2021-08-23 20:57:29 +02:00
Martin Algesten
641eb3df10 Fix overlapping redirect tests
Two tests were using /redirect_post1, which breaks if they are running in parallel.
2021-08-23 20:52:08 +02:00
Keijia
2869a80130 oh, use None != proto instead of proto.is_some() 2021-08-23 20:46:44 +02:00
Keijia
c7292919e5 fix build fails 2021-08-23 20:46:44 +02:00
Keijia
f6f021cdbb highlight that socks:// prefix is equal to socks5:// 2021-08-23 20:46:44 +02:00
Keijia
35c472507b whoops, fix tests for socks4://and socks4a:// 2021-08-23 20:46:44 +02:00
Keijia
401d051bd1 add socks4a:// and socks:// tests 2021-08-23 20:46:44 +02:00