From 5de7811f1070c6d6423b7033b36ca4c94420e286 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Sat, 6 Mar 2021 19:46:32 -0600 Subject: [PATCH 1/4] Add experimental rustls support Based on upstream work in https://github.com/alexcrichton/curl-rust/pull/374. --- Cargo.toml | 5 +++-- benchmarks/Cargo.toml | 2 +- examples/simple.rs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ac3d5457..7c4d8878 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,12 +28,13 @@ spnego = ["curl-sys/spnego"] static-curl = ["curl/static-curl"] static-ssl = ["curl/static-ssl"] text-decoding = ["encoding_rs", "mime"] +tls-rustls = ["curl/rustls"] unstable-interceptors = [] [dependencies] crossbeam-utils = "0.8" -curl = "0.4.34" -curl-sys = "0.4.37" +curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } +curl-sys = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } futures-lite = "1.11" http = "0.2.1" log = "0.4" diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 64e57c6e..3ae77d1e 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] criterion = "0.3" -curl = "0.4" +curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } rayon = "1" rouille = "3" diff --git a/examples/simple.rs b/examples/simple.rs index 636cadaf..d8470c0f 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -6,7 +6,7 @@ use isahc::prelude::*; fn main() -> Result<(), isahc::Error> { // Send a GET request and wait for the response headers. // Must be `mut` so we can read the response body. - let mut response = isahc::get("http://example.org")?; + let mut response = isahc::get("https://example.org")?; // Print some basic info about the response to standard output. println!("Status: {}", response.status()); From 2610c47b574eeca5456fcb0aede95cc86111a0e3 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Sat, 13 Nov 2021 14:11:17 -0600 Subject: [PATCH 2/4] Rename feature to indicate instability --- Cargo.toml | 2 +- README.md | 1 - src/lib.rs | 11 ++++++++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index ac0d6ed6..17fe1b4f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -28,7 +28,7 @@ spnego = ["curl-sys/spnego"] static-curl = ["curl/static-curl"] static-ssl = ["curl/static-ssl"] text-decoding = ["encoding_rs", "mime"] -tls-rustls = ["curl/rustls"] +unstable-rustls-tls = ["curl/rustls"] unstable-interceptors = [] [dependencies] diff --git a/README.md b/README.md index 87c142d1..e066826f 100644 --- a/README.md +++ b/README.md @@ -110,7 +110,6 @@ Not every library is perfect for every use-case. While Isahc strives to be a ful - **Tiny binaries**: If you are creating an application where tiny binary size is a key priority, you might find Isahc to be too large for you. While Isahc's dependencies are carefully curated and a number of features can be disabled, Isahc's core feature set includes things like async which does have some file size overhead. You might find something like [ureq] more suitable. - **WebAssembly support**: If your project needs to be able to be compiled to WebAssembly, then Isahc will probably not work for you. Instead you might like an HTTP client that supports multiple backends such as [Surf]. -- **Rustls support**: We hope to support [rustls] as a TLS backend someday, it is not currently supported directly. If for some reason rustls is a hard requirement for you, you'll need to use a different HTTP client for now. ## Sponsors diff --git a/src/lib.rs b/src/lib.rs index bbfc0549..efe3aa9f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,9 +47,8 @@ //! ``` //! //! If you want to customize the request by adding headers, setting timeouts, -//! etc, then you can create a [`Request`][Request] using a -//! builder-style fluent interface, then finishing it off with a -//! [`send`][RequestExt::send]: +//! etc, then you can create a [`Request`][Request] using a builder-style fluent +//! interface, then finishing it off with a [`send`][RequestExt::send]: //! //! ```no_run //! use isahc::{prelude::*, Request}; @@ -202,6 +201,12 @@ //! Unstable until the API is finalized. This an unstable feature whose //! interface may change between patch releases. //! +//! ### `unstable-rustls-tls` +//! +//! Use [rustls](https://github.com/rustls/rustls) as the TLS backend for HTTPS +//! requests. Currently unstable as the rustls backend in libcurl currently has +//! some known issues and is not yet recommended for production use. +//! //! # Logging and tracing //! //! Isahc logs quite a bit of useful information at various levels compatible From a8bb8d22afdfca7be1ec2042f3bd2930c16c0215 Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Thu, 6 Jan 2022 20:57:53 -0600 Subject: [PATCH 3/4] Rustls now in main branch --- Cargo.toml | 4 ++-- benchmarks/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 17fe1b4f..e6fa5ce3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,8 +35,8 @@ unstable-interceptors = [] async-channel = "1.6" castaway = "0.1" crossbeam-utils = "0.8" -curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } -curl-sys = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } +curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } +curl-sys = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } event-listener = "2.5" futures-lite = "1.11" http = "0.2.1" diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index 3ae77d1e..b0f32da7 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] criterion = "0.3" -curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "rustls" } +curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } rayon = "1" rouille = "3" From 5ebe8dd584ba1de65f9f39a68ac834980b4d284c Mon Sep 17 00:00:00 2001 From: "Stephen M. Coakley" Date: Fri, 7 Jan 2022 19:36:09 -0600 Subject: [PATCH 4/4] Use published curl version --- Cargo.toml | 4 ++-- benchmarks/Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e6fa5ce3..44312f7e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,8 +35,8 @@ unstable-interceptors = [] async-channel = "1.6" castaway = "0.1" crossbeam-utils = "0.8" -curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } -curl-sys = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } +curl = "0.4.42" +curl-sys = "0.4.52" event-listener = "2.5" futures-lite = "1.11" http = "0.2.1" diff --git a/benchmarks/Cargo.toml b/benchmarks/Cargo.toml index b0f32da7..4119e4f5 100644 --- a/benchmarks/Cargo.toml +++ b/benchmarks/Cargo.toml @@ -6,7 +6,7 @@ publish = false [dependencies] criterion = "0.3" -curl = { git = "https://github.com/alexcrichton/curl-rust", branch = "main" } +curl = "0.4.42" rayon = "1" rouille = "3"