diff --git a/Cargo.toml b/Cargo.toml index 75dae41..21b3770 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,7 +24,7 @@ required-features = ["cli"] ############################################# chrono = { version = "0.4", features = ["serde"] } log = "0.4" -reqwest = { version = "0.11.17", default-features = false, features = ["blocking", "json", "stream", "rustls-tls-native-roots"] } +reqwest = { version = "0.12.7", default-features = false, features = ["blocking", "json", "stream", "rustls-tls-native-roots"] } serde = { version = "1", features = ["derive"] } serde_json = "1" thiserror = "1.0" diff --git a/src/cli/bootstrap.rs b/src/cli/bootstrap.rs index f96e91d..bc87b33 100644 --- a/src/cli/bootstrap.rs +++ b/src/cli/bootstrap.rs @@ -8,7 +8,7 @@ use std::io::Write; use std::time::Duration; pub async fn download_file(url: &str, path: &str, silent: bool) -> Result<(), String> { - let client = reqwest::Client::builder() + let client = reqwest::ClientBuilder::new() .user_agent("bgpkit-broker/3") .timeout(Duration::from_secs(30)) .build() diff --git a/src/crawler/common.rs b/src/crawler/common.rs index d2e7e66..d454f75 100644 --- a/src/crawler/common.rs +++ b/src/crawler/common.rs @@ -85,7 +85,7 @@ pub fn extract_link_size(body: &str) -> Vec<(String, i64)> { } pub(crate) async fn fetch_body(url: &str) -> Result { - let client = reqwest::Client::builder() + let client = reqwest::ClientBuilder::new() .user_agent("bgpkit-broker/3") .pool_max_idle_per_host(0) .timeout(Duration::from_secs(30)) @@ -117,7 +117,7 @@ pub(crate) async fn crawl_months_list( from_month.map(|d| NaiveDate::from_ymd_opt(d.year(), d.month(), 1).unwrap()); let month_link_pattern: Regex = Regex::new(r#".*"#).unwrap(); - let body = reqwest::get(collector_root_url).await?.text().await?; + let body = fetch_body(collector_root_url).await?; let mut res = vec![]; for cap in month_link_pattern.captures_iter(body.as_str()) { let month = cap[1].to_owned();