From 588bec96b693acedd0ca770c9e87ba9df1760dee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Fortin=20Tam?= Date: Wed, 7 Aug 2024 19:01:53 -0400 Subject: [PATCH] utils/source-discoverer: Fix HTTP errors interpretation There can be many reasons why a request is not allowed or authorized. 403 and 405 HTTP error codes do not prompt the visitor for credentials. Only 401 and 407 responses are credentials prompts. Only raise a username and password request when facing a 401 or 407. Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/645 Fixes: https://gitlab.gnome.org/GNOME/gnome-calendar/-/issues/552 --- src/utils/gcal-source-discoverer.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils/gcal-source-discoverer.c b/src/utils/gcal-source-discoverer.c index d2874df7..f7efbb34 100644 --- a/src/utils/gcal-source-discoverer.c +++ b/src/utils/gcal-source-discoverer.c @@ -199,9 +199,9 @@ is_authentication_error (gint code) { switch (code) { + /* Only HTTP 401 and 407 errors are actual prompts for credentials. 403, 405, etc. are not. */ case SOUP_STATUS_UNAUTHORIZED: - case SOUP_STATUS_FORBIDDEN: - case SOUP_STATUS_METHOD_NOT_ALLOWED: + case SOUP_STATUS_PROXY_UNAUTHORIZED: return TRUE; }