fix(gpclient): keep cookie cache when the cached login gets no answer (#712)

* fix(gpclient): keep cookie cache when the cached login gets no answer

A connect or timeout error during the cached gateway login or cached portal
discovery deleted the --cookie-cache file and fell back to SAML, although the
server never rejected the cookie. Keep the cache and return the error for
unanswered requests; only clear it when the server responds.

* fix(gpclient): preserve cached cookies for all failed requests

---------

Co-authored-by: Kevin Yue <[email protected]>
This commit is contained in:
Kodiak FiresmithandKevin Yue authored and GitHub committed 2026-11-17 13:56:19 +08:00
1 parent 1072a35817
commit 754b220a9d
3 files changed
+172 -19

No files matched your search

+5
View File
@@ -292,6 +292,11 @@ impl<'a> ConnectHandler<'a> {
Ok(config) => Some((cred, config)),
Err(error) => {
self.check_cancelled()?;
// A failed request does not establish that the cookie was rejected.
if gateway::is_network_error(&error) {
warn!("Cached portal authentication request failed: {error}");
return Err(error);
}
warn!("Cached portal authentication failed: {error}");
self.clear_cookie_cache();
None