Ejemplo n.º 1
0
/**
 * soup_auth_get_info:
 * @auth: a #SoupAuth
 *
 * Gets an opaque identifier for @auth, for use as a hash key or the
 * like. #SoupAuth objects from the same server with the same
 * identifier refer to the same authentication domain (eg, the URLs
 * associated with them take the same usernames and passwords).
 *
 * Return value: the identifier
 **/
char *
soup_auth_get_info (SoupAuth *auth)
{
	g_return_val_if_fail (SOUP_IS_AUTH (auth), NULL);

	if (SOUP_IS_CONNECTION_AUTH (auth))
		return g_strdup (SOUP_AUTH_GET_CLASS (auth)->scheme_name);
	else {
		return g_strdup_printf ("%s:%s",
					SOUP_AUTH_GET_CLASS (auth)->scheme_name,
					auth->realm);
	}
}
Ejemplo n.º 2
0
static void
auth_got_body (SoupMessage *msg, gpointer manager)
{
	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)) {
			SoupMessageFlags flags;

			flags = soup_message_get_flags (msg);
			soup_message_set_flags (msg, flags & ~SOUP_MESSAGE_NEW_CONNECTION);
		}

		soup_session_requeue_message (priv->session, msg);
	}
	g_mutex_unlock (&priv->lock);
}