From 6ecde64fc33c440885e0732e11c249e11aaca5d7 Mon Sep 17 00:00:00 2001 From: Valentin Brandl Date: Wed, 14 Jun 2023 19:00:00 +0200 Subject: [PATCH] Disable default features for reqwest Using `reqwest` with default-features enabled will enable the `default-tls`, which in turn will enable the `native-tls` feautre which will result in an attempt to compile against OpenSSL [0]. If one wants to use `mastodon-async` without depending on OpenSSL, the default features for `reqwest` must be disabled. The default features for `mastodon-async` will enable `reqwest/default-tls`, so the default behaviour won't change, but now it is possible to declare the dependency on `mastodon-async` with default features disabled and the `rustls-tls` feature enabled, allowing to compile without a dependency on OpenSSL. [0]: https://github.com/seanmonstar/reqwest/blob/e02df1f448d845fe01e6ea82c76ec89a59e5d568/Cargo.toml#L30 --- Cargo.toml | 1 + README.md | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index afc29d4..dd914d5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -75,6 +75,7 @@ features = ["serde"] [dependencies.reqwest] version = "0.11" features = ["multipart", "json", "stream"] +default-features = false [dependencies.serde] version = "1" diff --git a/README.md b/README.md index 52ca7e1..efe614f 100644 --- a/README.md +++ b/README.md @@ -25,6 +25,14 @@ Alternatively, run the following command: $ cargo add mastodon-async ~~~ +### Use Rustls instead of OpenSSL + +To use Rustls instead of OpenSSL for HTTPS request, define the dependency as follows + +```toml +mastodon-async = { version = "1", default-features = false, features = ["rustls-tls"] } +``` + ## A Note on Debugging This library offers structured logging. To get better information about bugs or how something is working, I recommend adding the femme crate as a dependency,