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
This commit is contained in:
Jean-François Fortin Tam
2024-08-16 18:47:57 -04:00
parent 577efdd967
commit 588bec96b6
+2 -2
View File
@@ -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;
}