fix(auth): route HTTPS traffic through HTTP_PROXY when no HTTPS proxy is set#2744
fix(auth): route HTTPS traffic through HTTP_PROXY when no HTTPS proxy is set#2744tusharmath wants to merge 11 commits intomainfrom
Conversation
83d57cd to
9cdcc5e
Compare
| fn with_http_config(self, config: &HttpConfig) -> Self { | ||
| self.connect_timeout(Duration::from_secs(config.connect_timeout)) | ||
| .read_timeout(Duration::from_secs(config.read_timeout)) | ||
| .pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout)) | ||
| .pool_max_idle_per_host(config.pool_max_idle_per_host) | ||
| .redirect(Policy::limited(config.max_redirects)) | ||
| .hickory_dns(config.hickory) | ||
| .http2_adaptive_window(config.adaptive_window) | ||
| .http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs)) | ||
| .http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout)) | ||
| .http2_keep_alive_while_idle(config.keep_alive_while_idle) | ||
| .with_tls_config(config) | ||
| } |
There was a problem hiding this comment.
Missing proxy fallback in with_http_config
The with_http_config method applies all HTTP configuration including timeouts, connection pooling, and TLS settings, but it does NOT call .with_proxy_fallback(). This means the main LLM client created in llm_client.rs:27-30 will not benefit from the HTTP_PROXY fallback logic that is the core purpose of this PR.
While auth and MCP clients correctly chain .with_proxy_fallback()? before .with_tls_config(), the main HTTP client used for LLM API calls will still bypass the proxy in corporate environments where only HTTP_PROXY is set.
Fix:
fn with_http_config(self, config: &HttpConfig) -> anyhow::Result<Self> {
Ok(self.connect_timeout(Duration::from_secs(config.connect_timeout))
.read_timeout(Duration::from_secs(config.read_timeout))
.pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout))
.pool_max_idle_per_host(config.pool_max_idle_per_host)
.redirect(Policy::limited(config.max_redirects))
.hickory_dns(config.hickory)
.http2_adaptive_window(config.adaptive_window)
.http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs))
.http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout))
.http2_keep_alive_while_idle(config.keep_alive_while_idle)
.with_proxy_fallback()?
.with_tls_config(config))
}Note the method now returns anyhow::Result<Self> instead of Self to handle the error from with_proxy_fallback(), and the call to .build() in llm_client.rs:29 needs to be changed from .unwrap() to proper error handling.
| fn with_http_config(self, config: &HttpConfig) -> Self { | |
| self.connect_timeout(Duration::from_secs(config.connect_timeout)) | |
| .read_timeout(Duration::from_secs(config.read_timeout)) | |
| .pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout)) | |
| .pool_max_idle_per_host(config.pool_max_idle_per_host) | |
| .redirect(Policy::limited(config.max_redirects)) | |
| .hickory_dns(config.hickory) | |
| .http2_adaptive_window(config.adaptive_window) | |
| .http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs)) | |
| .http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout)) | |
| .http2_keep_alive_while_idle(config.keep_alive_while_idle) | |
| .with_tls_config(config) | |
| } | |
| fn with_http_config(self, config: &HttpConfig) -> anyhow::Result<Self> { | |
| Ok(self.connect_timeout(Duration::from_secs(config.connect_timeout)) | |
| .read_timeout(Duration::from_secs(config.read_timeout)) | |
| .pool_idle_timeout(Duration::from_secs(config.pool_idle_timeout)) | |
| .pool_max_idle_per_host(config.pool_max_idle_per_host) | |
| .redirect(Policy::limited(config.max_redirects)) | |
| .hickory_dns(config.hickory) | |
| .http2_adaptive_window(config.adaptive_window) | |
| .http2_keep_alive_interval(config.keep_alive_interval.map(Duration::from_secs)) | |
| .http2_keep_alive_timeout(Duration::from_secs(config.keep_alive_timeout)) | |
| .http2_keep_alive_while_idle(config.keep_alive_while_idle) | |
| .with_proxy_fallback()? | |
| .with_tls_config(config)) | |
| } | |
Spotted by Graphite
Is this helpful? React 👍 or 👎 to let us know.
No description provided.