From 6a1ab1eebb64f482a949f04fc1442c13ccb55e11 Mon Sep 17 00:00:00 2001 From: Tomas Popela Date: Wed, 27 Sep 2017 19:01:26 +0200 Subject: [PATCH] Bug 788238 - Fallback to another authentication type if the current failed Fallback to another authentication type if the current failed. More specifically if the Negotiate failed (kerberos is not properly configured), then libsoup should fallback to Basic auth (if server supports it). Currently in such case it is not possible to load the page at all (in WebKitGTK+). --- libsoup/soup-auth-manager.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/libsoup/soup-auth-manager.c b/libsoup/soup-auth-manager.c index b32ba900..62fe9c40 100644 --- a/libsoup/soup-auth-manager.c +++ b/libsoup/soup-auth-manager.c @@ -354,7 +354,7 @@ create_auth (SoupAuthManagerPrivate *priv, SoupMessage *msg) const char *header; SoupAuthClass *auth_class; char *challenge = NULL; - SoupAuth *auth; + SoupAuth *auth = NULL; int i; header = auth_header_for_message (msg); @@ -364,14 +364,14 @@ create_auth (SoupAuthManagerPrivate *priv, SoupMessage *msg) for (i = priv->auth_types->len - 1; i >= 0; i--) { auth_class = priv->auth_types->pdata[i]; challenge = soup_auth_manager_extract_challenge (header, auth_class->scheme_name); - if (challenge) + if (!challenge) + continue; + auth = soup_auth_new (G_TYPE_FROM_CLASS (auth_class), msg, challenge); + g_free (challenge); + if (auth) break; } - if (!challenge) - return NULL; - auth = soup_auth_new (G_TYPE_FROM_CLASS (auth_class), msg, challenge); - g_free (challenge); return auth; } -- 2.14.2