Enforce HTTP timeouts on a per-read (rather than per-request) basis (#3144)

## Summary

This leverages the new `read_timeout` property, which ensures that (like
pip) our timeout is not applied to the _entire_ request, but rather, to
each individual read operation.

Closes: #1921.

See: #1912.
This commit is contained in:
Charlie Marsh 2024-04-19 16:49:53 -04:00 committed by GitHub
parent 31765c05bd
commit 9f2bc19eaf
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 5 additions and 5 deletions

View file

@ -125,7 +125,7 @@ impl<'a> BaseClientBuilder<'a> {
})
})
.unwrap_or(default_timeout);
debug!("Using registry request timeout of {}s", timeout);
debug!("Using registry request timeout of {timeout}s");
// Initialize the base client.
let client = self.client.clone().unwrap_or_else(|| {
@ -145,7 +145,7 @@ impl<'a> BaseClientBuilder<'a> {
let client_core = ClientBuilder::new()
.user_agent(user_agent_string)
.pool_max_idle_per_host(20)
.timeout(std::time::Duration::from_secs(timeout))
.read_timeout(std::time::Duration::from_secs(timeout))
.tls_built_in_root_certs(false);
// Configure TLS.