sbstp / attohttpc

Rust lightweight HTTP 1.1 client

Home Page:https://docs.rs/attohttpc/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Offer rustls as an alternative to native-tls

sbstp opened this issue · comments

As suggested in the smoke testing blog post we could offer to use the rustls TLS backend instead of native-tls with a feature flag.

Note that this seems to be non-trivial endeavor as the API provided by rustls is significantly more low level than native-tls, i.e. does not seem to provide a straight-forward implementation of io::Read and io::Write.

Yeah what would be best is if there was a crate abstracting Tls functionality and allowed you to pick the backend.

@sbstp I have to correct myself: rustls already offers the StreamOwned wrapper to perform blocking I/O so that adding this does not seem much more involved than native-tls.

The need to handle the ConnectionAborted looks a bit strange but tokio-rustls uses the same condition to start its async shutdown dance.

If we want this to be even more high-level, we could use the rustls-connector crate but from the above linked commit I am not sure the additional dependency is worth the weight?