[libsoup/carlosgc/auth-fixes: 2/2] auth: emit authenticate signal if authenticate from uri credentials results in no authentication




commit d16899caceac01cecd1f9493ea1296e0e3068826
Author: Carlos Garcia Campos <cgarcia igalia com>
Date:   Fri Apr 22 11:54:14 2022 +0200

    auth: emit authenticate signal if authenticate from uri credentials results in no authentication

 libsoup/auth/soup-auth-manager.c | 18 +++++++++++++-----
 1 file changed, 13 insertions(+), 5 deletions(-)
---
diff --git a/libsoup/auth/soup-auth-manager.c b/libsoup/auth/soup-auth-manager.c
index 89b83bb5..4c1e0c6c 100644
--- a/libsoup/auth/soup-auth-manager.c
+++ b/libsoup/auth/soup-auth-manager.c
@@ -558,17 +558,25 @@ authenticate_auth (SoupAuthManager *manager, SoupAuth *auth,
 
        uri = soup_message_get_uri_for_auth (msg);
 
-       /* If a password is specified explicitly in the URI, use it
+       /* If a user is specified explicitly in the URI, use it
         * even if the auth had previously already been authenticated.
         */
        if (g_uri_get_user (uri)) {
                const char *password = g_uri_get_password (uri);
+
                soup_auth_authenticate (auth, g_uri_get_user (uri), password ? password : "");
 
-                GUri *new_uri = soup_uri_copy (uri, SOUP_URI_USER, NULL, SOUP_URI_PASSWORD, NULL, 
SOUP_URI_NONE);
-                soup_message_set_uri (msg, new_uri); // QUESTION: This didn't emit a signal previously
-                g_uri_unref (new_uri);
-       } else if (!soup_auth_is_authenticated (auth) && can_interact) {
+                if (soup_auth_is_authenticated (auth)) {
+                        GUri *new_uri = soup_uri_copy (uri, SOUP_URI_USER, NULL, SOUP_URI_PASSWORD, NULL, 
SOUP_URI_NONE);
+
+                        soup_message_set_uri (msg, new_uri); // QUESTION: This didn't emit a signal 
previously
+                        g_uri_unref (new_uri);
+
+                        return;
+                }
+       }
+
+        if (!soup_auth_is_authenticated (auth) && can_interact) {
                SoupMessage *original_msg;
                gboolean handled;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]