summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <cgarcia@igalia.com>2022-04-22 11:54:14 +0200
committerCarlos Garcia Campos <cgarcia@igalia.com>2022-04-22 11:55:59 +0200
commitd16899caceac01cecd1f9493ea1296e0e3068826 (patch)
treedb47daa1947bba35ecafd1c15d994c519c0a2db0
parent6b55a2514c5550057c764dd9bc43095ab3fc2a7d (diff)
downloadlibsoup-carlosgc/auth-fixes.tar.gz
auth: emit authenticate signal if authenticate from uri credentials results in no authenticationcarlosgc/auth-fixes
-rw-r--r--libsoup/auth/soup-auth-manager.c18
1 files 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;