Skip to content

Commit a17cbe8

Browse files
committed
fix(auth): use the timeout-bounded HTTP client for workspace fetch and auth probe
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.
1 parent b231f85 commit a17cbe8

2 files changed

Lines changed: 3 additions & 3 deletions

File tree

‎src/client/credentials.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ pub fn check_status(profile_config: &config::ProfileConfig) -> AuthStatus {
3939
};
4040

4141
let url = format!("{}/workspaces", profile_config.api_url);
42-
let client = reqwest::blocking::Client::new();
42+
let client = crate::client::raw_http::build_http_client();
4343
let req = client
4444
.get(&url)
4545
.header("Authorization", format!("Bearer {access_token}"));

‎src/commands/auth.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ fn cache_workspaces(
440440
access_token: &str,
441441
) -> Result<Vec<config::WorkspaceEntry>, String> {
442442
let url = format!("{}/workspaces", profile.api_url);
443-
let client = reqwest::blocking::Client::new();
443+
let client = crate::client::raw_http::build_http_client();
444444
let req = client
445445
.get(&url)
446446
.header("Authorization", format!("Bearer {access_token}"));
@@ -485,7 +485,7 @@ fn api_key_authorized_workspaces(
485485
return Vec::new();
486486
};
487487
let url = format!("{}/workspaces", profile_config.api_url);
488-
let client = reqwest::blocking::Client::new();
488+
let client = crate::client::raw_http::build_http_client();
489489
let req = client
490490
.get(&url)
491491
.header("Authorization", format!("Bearer {access_token}"));

0 commit comments

Comments
 (0)