Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Optional rustls support #378

Closed
seanmonstar opened this issue Oct 30, 2018 · 3 comments · Fixed by #390
Closed

Optional rustls support #378

seanmonstar opened this issue Oct 30, 2018 · 3 comments · Fixed by #390

Comments

@seanmonstar
Copy link
Owner

With the ability to now optionally disable the default-tls feature (#375), it would also be fantastic to allow people to use reqwest with a rustls backend instead.

  • We can add rustls as a dependency, optional = true. This will automatically promote to a rustls feature, defaulted off.
  • The code inside the connect module can likely inline the connector code from hyper-tls and hyper-rustls, so we can remove that dependency.
  • The transport should just be a trait object, essentially Box<AsyncRead + AsyncWrite>.
  • If both default-tls and rustls are enabled, the native-tls backend should be chosen by default.
  • The ClientBuilder can gain methods to pick a backend at runtime.
@timleg002
Copy link

Shouldn't rustls be chosen by default when both are enabled? To avoid verboseness via default-features = false

@evbo
Copy link

evbo commented Aug 8, 2023

For anyone else wondering how to add rust-tls, set feature flags like the following in your Cargo.toml:

reqwest = { 
    version = "0.11.16", 
    features = ["json", "rustls-tls"], 
    default-features = false 
}

@xpe
Copy link

xpe commented Jan 11, 2024

Using features = ["json", "rustls-tls"], default-features = false works, but, however on my MacBook Pro M2 at least, trace-level logging looks awful. (It worked fine on the default settings, FWIW).

e.g. (using env_logger):

[2024-01-11T21:50:08Z DEBUG reqwest::connect] starting new connection: https://api.foobarbuzzapp.website/
[2024-01-11T21:50:08Z TRACE reqwest::connect::verbose] 0897ca88 write: b"PRI * HTTP/2.0\r\n\r\nSM\r\n\r\n"
[2024-01-11T21:50:08Z TRACE reqwest::connect::verbose] 0897ca88 write: b"\0\0\x12\x04\0\0\0\0\0\0\x02\0\0\0\0\0\x04\0 \0\0\0\x05\0\0@\0\0\0\x04\x08\0\0\0\0\0\0O\0\x01"

UPDATE: Ugly logging, yes, but this is good -- it is HTTP 2/at work. It is good that rust-tls made it happen :)

Repository owner locked and limited conversation to collaborators Jan 12, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants