From a17cbe892aed6fe5384361b768905546f4c54f9c Mon Sep 17 00:00:00 2001 From: Eddie A Tejeda <669988+eddietejeda@users.noreply.github.com> Date: Mon, 20 Jul 2026 09:19:15 -0700 Subject: [PATCH] fix(auth): use the timeout-bounded HTTP client for workspace fetch and auth probe MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Follow-up from #230: cache_workspaces, api_key_authorized_workspaces, and credentials::check_status used bare reqwest::blocking::Client::new(), which has no request timeout — a stalled server could hang 'auth login' or the 4xx auth-status probe (which runs inside error printing) indefinitely. They now share raw_http::build_http_client() (300s cap + TCP keepalive) like every other raw-HTTP path. Test-only localhost clients are left as-is. --- src/client/credentials.rs | 2 +- src/commands/auth.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/credentials.rs b/src/client/credentials.rs index e6c3b28..459aec2 100644 --- a/src/client/credentials.rs +++ b/src/client/credentials.rs @@ -39,7 +39,7 @@ pub fn check_status(profile_config: &config::ProfileConfig) -> AuthStatus { }; let url = format!("{}/workspaces", profile_config.api_url); - let client = reqwest::blocking::Client::new(); + let client = crate::client::raw_http::build_http_client(); let req = client .get(&url) .header("Authorization", format!("Bearer {access_token}")); diff --git a/src/commands/auth.rs b/src/commands/auth.rs index 6ea6201..9138ceb 100644 --- a/src/commands/auth.rs +++ b/src/commands/auth.rs @@ -440,7 +440,7 @@ fn cache_workspaces( access_token: &str, ) -> Result, String> { let url = format!("{}/workspaces", profile.api_url); - let client = reqwest::blocking::Client::new(); + let client = crate::client::raw_http::build_http_client(); let req = client .get(&url) .header("Authorization", format!("Bearer {access_token}")); @@ -485,7 +485,7 @@ fn api_key_authorized_workspaces( return Vec::new(); }; let url = format!("{}/workspaces", profile_config.api_url); - let client = reqwest::blocking::Client::new(); + let client = crate::client::raw_http::build_http_client(); let req = client .get(&url) .header("Authorization", format!("Bearer {access_token}"));