From 9bcaae71fc9f58b5d1495de0484fc41d6df227d4 Mon Sep 17 00:00:00 2001 From: daltoncoder Date: Tue, 4 Jun 2024 13:28:13 -0400 Subject: [PATCH] fix: use rustls_tls for reqwest client --- core/origin-http/Cargo.toml | 2 +- core/origin-http/src/lib.rs | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/core/origin-http/Cargo.toml b/core/origin-http/Cargo.toml index e93673f32..4479c0ec4 100644 --- a/core/origin-http/Cargo.toml +++ b/core/origin-http/Cargo.toml @@ -8,7 +8,7 @@ affair.workspace = true anyhow.workspace = true fast-sri = { path = "../../lib/fast-sri" } lightning-interfaces = { path = "../interfaces" } -reqwest = "0.11" +reqwest = { version = "0.11", features = ["rustls-tls"] } serde.workspace = true url = "2.5.0" workspace-hack = { version = "0.1", path = "../../etc/workspace-hack" } diff --git a/core/origin-http/src/lib.rs b/core/origin-http/src/lib.rs index ceb75a54f..4295dffa5 100644 --- a/core/origin-http/src/lib.rs +++ b/core/origin-http/src/lib.rs @@ -7,7 +7,7 @@ use std::time::Duration; use fast_sri::IntegrityMetadata; use lightning_interfaces::prelude::*; use lightning_interfaces::types::{Blake3Hash, CompressionAlgorithm}; -use reqwest::{Client, Url}; +use reqwest::{Client, ClientBuilder, Url}; pub use crate::config::Config; @@ -27,7 +27,10 @@ impl Clone for HttpOrigin { impl HttpOrigin { pub fn new(_: Config, blockstore: C::BlockstoreInterface) -> anyhow::Result { - let client = Client::new(); + let client = ClientBuilder::new() + .use_rustls_tls() + .build() + .expect("Unable to make reqwest https client in http origin"); Ok(Self { client, blockstore }) } @@ -36,7 +39,7 @@ impl HttpOrigin { let resp = self .client .get(url) - .timeout(Duration::from_millis(500)) + .timeout(Duration::from_millis(1000)) .send() .await?; let mut data: Vec = resp.bytes().await?.into();