GPtrArray *auth_types;
gboolean auto_ntlm;
+ GMutex lock;
SoupAuth *proxy_auth;
GHashTable *auth_hosts;
};
soup_uri_host_equal,
NULL,
(GDestroyNotify)soup_auth_host_free);
+ g_mutex_init (&priv->lock);
}
static void
g_clear_object (&priv->proxy_auth);
+ g_mutex_clear (&priv->lock);
+
G_OBJECT_CLASS (soup_auth_manager_parent_class)->finalize (object);
}
SoupAuth *auth, *prior_auth, *new_auth;
gboolean prior_auth_failed = FALSE;
+ g_mutex_lock (&priv->lock);
+
/* See if we used auth last time */
prior_auth = soup_message_get_auth (msg);
if (prior_auth && check_auth (msg, prior_auth)) {
prior_auth_failed = TRUE;
} else {
auth = create_auth (priv, msg);
- if (!auth)
+ if (!auth) {
+ g_mutex_unlock (&priv->lock);
return;
+ }
}
new_auth = record_auth_for_uri (priv, soup_message_get_uri (msg),
/* If we need to authenticate, try to do it. */
authenticate_auth (manager, new_auth, msg,
prior_auth_failed, FALSE, TRUE);
+ g_mutex_unlock (&priv->lock);
}
static void
SoupAuthManagerPrivate *priv = SOUP_AUTH_MANAGER (manager)->priv;
SoupAuth *auth;
+ g_mutex_lock (&priv->lock);
auth = lookup_auth (priv, msg);
if (auth && soup_auth_is_ready (auth, msg)) {
if (SOUP_IS_CONNECTION_AUTH (auth)) {
soup_session_requeue_message (priv->session, msg);
}
+ g_mutex_unlock (&priv->lock);
}
static void
SoupAuth *prior_auth;
gboolean prior_auth_failed = FALSE;
+ g_mutex_lock (&priv->lock);
+
/* See if we used auth last time */
prior_auth = soup_message_get_proxy_auth (msg);
if (prior_auth && check_auth (msg, prior_auth)) {
if (!priv->proxy_auth) {
priv->proxy_auth = create_auth (priv, msg);
- if (!priv->proxy_auth)
+ if (!priv->proxy_auth) {
+ g_mutex_unlock (&priv->lock);
return;
+ }
}
/* If we need to authenticate, try to do it. */
authenticate_auth (manager, priv->proxy_auth, msg,
prior_auth_failed, TRUE, TRUE);
+ g_mutex_unlock (&priv->lock);
}
static void
proxy_auth_got_body (SoupMessage *msg, gpointer manager)
{
SoupAuthManagerPrivate *priv = SOUP_AUTH_MANAGER (manager)->priv;
- SoupAuth *auth = priv->proxy_auth;
+ SoupAuth *auth;
+
+ g_mutex_lock (&priv->lock);
+ auth = priv->proxy_auth;
if (auth && soup_auth_is_ready (auth, msg))
soup_session_requeue_message (priv->session, msg);
+ g_mutex_unlock (&priv->lock);
}
static void
SoupAuthManagerPrivate *priv = manager->priv;
SoupAuth *auth;
+ g_mutex_lock (&priv->lock);
+
auth = lookup_auth (priv, msg);
if (auth) {
authenticate_auth (manager, auth, msg, FALSE, FALSE, FALSE);
auth = NULL;
}
soup_message_set_proxy_auth (msg, auth);
+
+ g_mutex_unlock (&priv->lock);
}
static void
{
SoupAuthManagerPrivate *priv = manager->priv;
+ g_mutex_lock (&priv->lock);
record_auth_for_uri (priv, uri, auth);
+ g_mutex_unlock (&priv->lock);
}
static void