Skip to content

Commit

Permalink
Add experimental rustls support (#309)
Browse files Browse the repository at this point in the history
Add the ability to opt-in to using rustls as the TLS engine for HTTPS requests with a `unstable-rustls-tls` crate feature.

Based on upstream work in alexcrichton/curl-rust#374.

See #199.
  • Loading branch information
sagebind authored Jan 8, 2022
1 parent 3c61944 commit f3b5c3c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,15 @@ spnego = ["curl-sys/spnego"]
static-curl = ["curl/static-curl"]
static-ssl = ["curl/static-ssl"]
text-decoding = ["encoding_rs", "mime"]
unstable-rustls-tls = ["curl/rustls"]
unstable-interceptors = []

[dependencies]
async-channel = "1.6"
castaway = "0.1"
crossbeam-utils = "0.8"
curl = "0.4.36"
curl-sys = "0.4.42"
curl = "0.4.42"
curl-sys = "0.4.52"
event-listener = "2.5"
futures-lite = "1.11"
http = "0.2.1"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion benchmarks/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ publish = false

[dependencies]
criterion = "0.3"
curl = "0.4"
curl = "0.4.42"
rayon = "1"
rouille = "3"

Expand Down
2 changes: 1 addition & 1 deletion examples/simple.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
11 changes: 8 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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};
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f3b5c3c

Please sign in to comment.