Martin Algesten
653cf03dee
Fix and and
...
Close #503
2022-04-24 19:40:20 +02:00
Martin Algesten
ce13168a96
Run cargo readme
2022-04-22 20:41:40 +02:00
dependabot[bot]
e4f064d4f2
Update rustls-pemfile requirement from 0.3 to 1.0
...
Updates the requirements on [rustls-pemfile](https://github.com/rustls/pemfile ) to permit the latest version.
- [Release notes](https://github.com/rustls/pemfile/releases )
- [Commits](https://github.com/rustls/pemfile/compare/v/0.3.0...v/1.0.0 )
---
updated-dependencies:
- dependency-name: rustls-pemfile
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-04-22 19:26:47 +02:00
Ed Morley
a8ed085a93
Fix broken TLS anchor link in docs overview
...
Now correctly links to:
https://docs.rs/ureq/latest/ureq/#https--tls--ssl
Introduced in 56276c3742 .
Also fixes a rustdoc typo spotted by my IDE's spell checker whilst the
project was open.
2022-04-22 19:25:44 +02:00
Martin Algesten
21238ef2e0
Provide example of more in-depth TLS config
...
Close #480
2022-04-12 20:43:27 +02:00
Martin Algesten
e225532966
Update cookie dep to 0.16
2022-04-12 20:33:09 +02:00
Pierre Dubouilh
0a71385b29
fix clippy
2022-04-08 09:53:55 +02:00
Pierre Dubouilh
aced0d9b6a
implement https_only flag
2022-04-08 09:53:55 +02:00
Joshua Nelson
06743da5de
Warn if Requests aren't sent ( #490 )
...
I added `ureq::get("http://example.com ")` to a toy program and was very confused when it did nothing.
Change `Request` to give a warning if unsent:
```
warning: unused `ureq::Request` that must be used
--> src/main.rs:48:5
|
48 | ureq::get("http://example.com ");
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
= note: `#[warn(unused_must_use)]` on by default
= note: Requests do nothing until consumed by `call()`
```
2022-03-16 15:27:10 -07:00
dependabot[bot]
f549184d7f
Update rustls-pemfile requirement from 0.2 to 0.3
...
Updates the requirements on [rustls-pemfile](https://github.com/rustls/pemfile ) to permit the latest version.
- [Release notes](https://github.com/rustls/pemfile/releases )
- [Commits](https://github.com/rustls/pemfile/compare/v/0.2.0...v/0.3.0 )
---
updated-dependencies:
- dependency-name: rustls-pemfile
dependency-type: direct:production
...
Signed-off-by: dependabot[bot] <support@github.com >
2022-02-10 17:25:50 +01:00
Martin Algesten
4f3ea15523
Clean up mbedtls example
2022-01-31 09:45:57 +01:00
Martin Algesten
5dbaa9a256
Rename example mbedtls-req -> mbedtls
2022-01-31 09:45:57 +01:00
Michael Richardson
d75643b478
added comment about why socket always returns None
2022-01-31 09:33:38 +01:00
Michael Richardson
034981f535
added example of using mbedtls as a TLS provider
...
make authentication mode a parameter, default to Required
2022-01-31 09:33:38 +01:00
Malloc Voidstar
ff0e91d33e
Fix rustls version spec
...
">=0.20.1" doesn't have an upper bound and will accept 0.21 (and higher) once they're available.
"0.20.1" means "^0.20.1", which means ">=0.20.1, <0.21".
https://doc.rust-lang.org/cargo/reference/specifying-dependencies.html#caret-requirements
2022-01-31 09:16:39 +01:00
Martin Algesten
2c29cc230c
Remove Sync requirement of ReadWrite trait
...
3rd party TLS connections are currently required to provide a Sync
guarantee. Since ureq will only ever use the connection on a single
thread, this is not necessary.
The reason we end up with this bound is because we want Response and
Error to be Sync, in which case Rust's automatic inferral of Sync
fails.
This change "masks" the Stream in a wrapper making it Sync.
Close #474
2022-01-30 21:50:11 +01:00
Martin Algesten
219b5edf9e
Rename test function as_write_vec -> into_written_bytes
...
Tests use `Response::as_write_vec` to inspect the outgoing HTTP/1.1
request line and headers. The current version has two problems:
1. Called `as_write_vec` when it actually returns a `&[u8]`.
2. Inspects/uses the `Response::stream` without consuming `Response`.
The first problem is trivial, but the second is subtle. Currently all
calls on `Response` that works with the internal `Response::stream`
consumes `self` (`into_string`, `into_reader`).
`Response` is by itself `Send + Sync`, and must be so because the
nested Stream is `Read + Write + Send + Sync`. However for
implementors of `TLSStream`, it would be nice to relax the `Sync`
requirement.
Assumption: If all fields in Response are `Sync` except
`Response::stream`, but any access to `stream` consumes `Response`, we
can consider the entire `Response` `Sync`.
This assumption can help us relax the `TlsStream` `Sync` requirement
in a later PR.
2022-01-29 17:32:18 +01:00
Martin Algesten
6e5041044b
Rename trait HttpsStream -> ReadWrite and make it public
...
Also provide an example of how to use it.
2022-01-22 10:41:22 +01:00
Daniel
140aa5901f
Add tcp no_delay option ( #465 )
...
* Add tcp no_delay option
2022-01-06 23:22:33 +01:00
Martin Algesten
007ce44ea7
Bump version to 2.4.0
2021-12-23 08:38:00 +01:00
Martin Algesten
adbd9144af
Update changelog for 2.4.0
2021-12-23 08:38:00 +01:00
Martin Algesten
3b68dce23a
Make Middleware always Send + Sync + 'static
2021-12-22 07:58:45 +01:00
Martin Algesten
81c0e66ec7
MiddlewareNext iterator without Box
...
Thanks @jsha for showing me the way.
2021-12-22 07:58:45 +01:00
Martin Algesten
43680335dc
Middleware chain based on iterator
2021-12-22 07:58:45 +01:00
Martin Algesten
a2d62368f3
Remove Option wrapper around middleware
2021-12-22 07:58:45 +01:00
Martin Algesten
09ecb6ffd6
Implement middleware function
2021-12-22 07:58:45 +01:00
Martin Algesten
7b2f28bbc2
Tidy up Response::url initialization
2021-12-22 07:58:45 +01:00
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
c55ac31087
Fix quoting in test runner
2021-12-20 09:20:52 +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
Jacob Hoffman-Andrews
2563df4f62
Bump rustls to >=0.20.1
...
Without this we get a build error because we depend on an impl of Error
on InvalidDnsNameError.
2021-12-20 02:39:38 +01: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
024bcaac99
Add gzip/brotli to README
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