SoupAuthManager: Prefer auth passed in with soup_auth_manager_use_auth()
The SoupAuthManager
currently prefers already set SoupAuth
for a given URI, instead of using the one passed in with soup_auth_manager_use_auth()
. This can break authentications like OAuth2 (it happened to me at least), when the caller needs to ensure that a fresh SoupAuth
is used, instead of the previous one. As the soup_auth_manager_use_auth()
is not called by libsoup itself at all (only in an NTLM test), I suggest to change this:
void
soup_auth_manager_use_auth (SoupAuthManager *manager,
SoupURI *uri,
SoupAuth *auth)
{
SoupAuthManagerPrivate *priv = manager->priv;
g_mutex_lock (&priv->lock);
- record_auth_for_uri (priv, uri, auth, FALSE);
+ record_auth_for_uri (priv, uri, auth, TRUE);
g_mutex_unlock (&priv->lock);
}
If I understand it correctly, I can workaround this behavior (the referenced comment has a wrong precondition in my case) with soup_auth_manager_clear_cached_credentials()
.