Skip to content

Commit

Permalink
Remove webpki to fix FOSSA license error
Browse files Browse the repository at this point in the history
  • Loading branch information
diehuxx committed Sep 23, 2024
1 parent 27115c7 commit ae2f929
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion crates/web5/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ zbase32 = "0.1.2"
lazy_static = "1.5.0"
flate2 = "1.0.33"
rustls = { version = "0.23.13", default-features = false, features = ["std", "tls12"] }
webpki-roots = "0.26.5"
rustls-native-certs = "0.8.0"

[dev-dependencies]
mockito = "1.5.0"
Expand Down
9 changes: 6 additions & 3 deletions crates/web5/src/http.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
use crate::errors::{Result, Web5Error};
use rustls::pki_types::ServerName;
use rustls::{ClientConfig, ClientConnection, RootCertStore, StreamOwned};
use rustls_native_certs::load_native_certs;
use serde::de::DeserializeOwned;
use std::collections::HashMap;
use std::io::{Read, Write};
use std::net::TcpStream;
use std::sync::Arc;
use url::Url;
use webpki_roots::TLS_SERVER_ROOTS;

pub struct HttpResponse {
pub status_code: u16,
Expand Down Expand Up @@ -57,8 +57,11 @@ fn transmit(destination: &Destination, request: &[u8]) -> Result<Vec<u8>> {
if destination.schema == "https" {
// HTTPS connection

// Create a RootCertStore and load the root certificates from webpki-roots
let root_store = RootCertStore::from_iter(TLS_SERVER_ROOTS.iter().cloned());
// Create a RootCertStore and load the root certificates from rustls_native_certs
let mut root_store = RootCertStore::empty();
for cert in load_native_certs().unwrap() {
root_store.add(cert).unwrap();
}

// Build the ClientConfig using the root certificates and disabling client auth
let config = ClientConfig::builder()
Expand Down

0 comments on commit ae2f929

Please sign in to comment.