diff --git a/CHANGELOG.md b/CHANGELOG.md index 6a13c14..80b27c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ # Changelog +## v2.0.1 (2022-03-03) +- Bug fix release to handle improper timeouts on HTTP requests + ## v2.0.0 (2022-02-26) Shellcaster version 2.0.0 brings many added features and performance improvements, but there are a few breaking changes to the configuration file to be aware of. These are listed below. You can download the default config file from here, to reference when updating your local config: https://raw.githubusercontent.com/jeff-hughes/shellcaster/master/config.toml diff --git a/Cargo.lock b/Cargo.lock index 7c18b8d..392dbf3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -963,7 +963,7 @@ dependencies = [ [[package]] name = "shellcaster" -version = "2.0.0" +version = "2.0.1" dependencies = [ "ahash", "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 206c998..0d2c263 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "shellcaster" -version = "2.0.0" +version = "2.0.1" authors = ["Jeff Hughes "] edition = "2021" license = "GPL-3.0-or-later" diff --git a/src/downloads.rs b/src/downloads.rs index 8ce9de8..7dc8c65 100644 --- a/src/downloads.rs +++ b/src/downloads.rs @@ -58,7 +58,9 @@ pub fn download_list( /// Downloads a file to a local filepath, returning DownloadMsg variant /// indicating success or failure. fn download_file(mut ep_data: EpData, dest: PathBuf, mut max_retries: usize) -> DownloadMsg { - let agent_builder = ureq::builder(); + let agent_builder = ureq::builder() + .timeout_connect(Duration::from_secs(10)) + .timeout_read(Duration::from_secs(120)); #[cfg(feature = "native_tls")] let tls_connector = std::sync::Arc::new(native_tls::TlsConnector::new().unwrap()); #[cfg(feature = "native_tls")] @@ -66,10 +68,7 @@ fn download_file(mut ep_data: EpData, dest: PathBuf, mut max_retries: usize) -> let agent = agent_builder.build(); let request: Result = loop { - let response = agent - .get(&ep_data.url) - .timeout(Duration::from_secs(30)) - .call(); + let response = agent.get(&ep_data.url).call(); match response { Ok(resp) => break Ok(resp), Err(_) => { diff --git a/src/feeds.rs b/src/feeds.rs index 1228534..a9f7d97 100644 --- a/src/feeds.rs +++ b/src/feeds.rs @@ -73,7 +73,9 @@ pub fn check_feed( /// Given a URL, this attempts to pull the data about a podcast and its /// episodes from an RSS feed. fn get_feed_data(url: String, mut max_retries: usize) -> Result { - let agent_builder = ureq::builder(); + let agent_builder = ureq::builder() + .timeout_connect(Duration::from_secs(5)) + .timeout_read(Duration::from_secs(20)); #[cfg(feature = "native_tls")] let tls_connector = std::sync::Arc::new(native_tls::TlsConnector::new().unwrap()); #[cfg(feature = "native_tls")] @@ -81,7 +83,7 @@ fn get_feed_data(url: String, mut max_retries: usize) -> Result { let agent = agent_builder.build(); let request: Result = loop { - let response = agent.get(&url).timeout(Duration::from_secs(20)).call(); + let response = agent.get(&url).call(); match response { Ok(resp) => break Ok(resp), Err(_) => {