seanmonstar / reqwest

An easy and powerful Rust HTTP Client
https://docs.rs/reqwest
Apache License 2.0
9.95k stars 1.13k forks source link

Add webpki roots option for rustls no provider setup #2447

Closed stevefan1999-personal closed 3 weeks ago

stevefan1999-personal commented 1 month ago

This PR allows you to use webpki roots without having to enable ring, and allows custom providers to test. It also immediately shaved 90KB off my binary for a personal embedded project I'm working on without resorting to a hack like this:

pub fn make_client() -> Result<Client, Error> {
    let mut builder = Client::builder();
    for cert in webpki_root_certs::TLS_SERVER_ROOT_CERTS {
        builder = builder.add_root_certificate(Certificate::from_der(cert).unwrap())
    }
    builder.build()
}