The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]
Python ai-gatewayanthropicazure-openaibedrockgatewaylangchainlitellmllmllm-gatewayllmopsmcp-gatewayopenaiopenai-proxyrustrust-aivertex-ai
fix(rust): restore the 10s connect timeout and share media clients across proxy settings
Yujong Lee0119f5001581
diff --git a/litellm-rust/crates/http/src/pool.rs b/litellm-rust/crates/http/src/pool.rsindex 0d9b1abf504..b51e6711419 100644--- a/litellm-rust/crates/http/src/pool.rs+++ b/litellm-rust/crates/http/src/pool.rs@@ -51,6 +51,7 @@ impl HttpClientPool {let effective = match variant {ClientVariant::Media => HttpClientConfig {client_certificate: None,+ trust_proxy_env: false,..config.clone()},ClientVariant::Provider | ClientVariant::NoRedirect => config.clone(),@@ -86,7 +87,6 @@ impl HttpClientPool {ClientVariant::NoRedirect => builder.redirect(reqwest::redirect::Policy::none()),ClientVariant::Media => builder.redirect(reqwest::redirect::Policy::none())- .no_proxy().dns_resolver2(Arc::clone(&self.media_resolver)),}}@@ -206,6 +206,21 @@ mod tests {assert_eq!(connections.load(Ordering::SeqCst), 2);}+ #[tokio::test]+ async fn media_clients_are_shared_across_proxy_settings_they_never_use() {+ let (address, connections, _) = serve("HTTP/1.1 204 No Content").await;+ let pool = HttpClientPool::new(Arc::new(FixedResolver(address)));+ let url = format!("http://media.invalid:{}/doc", address.port());+ for trust_proxy_env in [true, false] {+ let config = HttpClientConfig {+ trust_proxy_env,+ ..config("a")+ };+ get(&pool, &config, ClientVariant::Media, &url).await;+ }+ assert_eq!(connections.load(Ordering::SeqCst), 1);+ }+#[test]fn media_variant_never_loads_the_client_certificate() {let pool = pool();diff --git a/litellm-rust/crates/http/src/settings.rs b/litellm-rust/crates/http/src/settings.rsindex c572c56ef3a..8aaf7f21f2c 100644--- a/litellm-rust/crates/http/src/settings.rs+++ b/litellm-rust/crates/http/src/settings.rs@@ -50,7 +50,7 @@ impl Default for HttpSettings {user_agent: None,trust_proxy_env: false,ignore_proxy_env: false,- connect_timeout: Duration::from_secs(5),+ connect_timeout: Duration::from_secs(10),}}}