refactor: remove tcp_keepalive options for reqwest >=0.12.23

This commit is contained in:
monosans
2025-08-12 21:36:50 +03:00
parent ee08110a20
commit b7bf6df5a6
-11
View File
@@ -175,26 +175,15 @@ pub fn create_reqwest_client<R: reqwest::dns::Resolve + 'static>(
config: &Config,
dns_resolver: Arc<R>,
) -> reqwest::Result<reqwest::Client> {
// TODO: remove tcp_keepalive related options for reqwest >=0.12.23
let mut builder = reqwest::ClientBuilder::new()
.user_agent(&config.scraping.user_agent)
.timeout(config.scraping.timeout)
.connect_timeout(config.scraping.connect_timeout)
.tcp_keepalive(Some(Duration::from_secs(15)))
.tcp_keepalive_interval(Some(Duration::from_secs(15)))
.tcp_keepalive_retries(Some(3))
.dns_resolver(dns_resolver);
if let Some(proxy) = &config.scraping.proxy {
builder = builder.proxy(reqwest::Proxy::all(proxy.clone())?);
}
#[cfg(any(
target_os = "android",
target_os = "fuchsia",
target_os = "linux"
))]
let builder = builder.tcp_user_timeout(Some(Duration::from_secs(30)));
builder.build()
}