Skip to content

Commit

Permalink
fix: stop using preconfigured tls (#3251)
Browse files Browse the repository at this point in the history
  • Loading branch information
Marcin Nowak-Liebiediew authored Jul 18, 2023
1 parent 92866c4 commit 63aadd9
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
10 changes: 1 addition & 9 deletions src/dfx/src/lib/project/import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -239,16 +239,8 @@ impl Loader {

fn client(&mut self) -> Result<&Client, ProjectError> {
if self.client.is_none() {
let tls_config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_webpki_roots()
.with_no_client_auth();

// Advertise support for HTTP/2
//tls_config.alpn_protocols = vec![b"h2".to_vec(), b"http/1.1".to_vec()];

let client = reqwest::Client::builder()
.use_preconfigured_tls(tls_config)
.use_rustls_tls()
.build()
.map_err(ProjectError::CouldNotCreateHttpClient)?;
self.client = Some(client);
Expand Down
7 changes: 1 addition & 6 deletions src/dfx/src/util/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,8 @@ pub async fn download_file_to_path(from: &Url, to: &Path) -> DfxResult {

#[context("Failed to download from url: {}.", from)]
pub async fn download_file(from: &Url) -> DfxResult<Vec<u8>> {
let tls_config = rustls::ClientConfig::builder()
.with_safe_defaults()
.with_webpki_roots()
.with_no_client_auth();

let client = reqwest::Client::builder()
.use_preconfigured_tls(tls_config)
.use_rustls_tls()
.build()
.context("Could not create HTTP client.")?;

Expand Down

0 comments on commit 63aadd9

Please sign in to comment.