Index: soup-session.c
===================================================================
RCS file: /cvs/gnome/libsoup/libsoup/soup-session.c,v
retrieving revision 1.22
diff -u -r1.22 soup-session.c
--- soup-session.c	14 Jul 2004 15:21:07 -0000	1.22
+++ soup-session.c	8 Feb 2005 18:46:52 -0000
@@ -620,8 +620,7 @@
 
 static gboolean
 update_auth_internal (SoupSession *session, SoupMessage *msg,
-		      const GSList *headers, gboolean proxy,
-		      gboolean got_unauthorized)
+		      const GSList *headers, gboolean proxy)
 {
 	SoupSessionHost *host;
 	SoupAuth *new_auth, *prior_auth, *old_auth;
@@ -648,20 +647,12 @@
 		return FALSE;
 
 	/* See if this auth is the same auth we used last time */
-	prior_auth = lookup_auth (session, msg, proxy);
+	prior_auth = g_object_get_data (G_OBJECT (msg),
+					proxy ? "SoupSession-proxyauth" : "SoupSession-auth");
 	if (prior_auth &&
 	    G_OBJECT_TYPE (prior_auth) == G_OBJECT_TYPE (new_auth) &&
 	    !strcmp (soup_auth_get_realm (prior_auth),
 		     soup_auth_get_realm (new_auth))) {
-		if (!got_unauthorized) {
-			/* The user is just trying to preauthenticate
-			 * using information we already have, so
-			 * there's nothing more that needs to be done.
-			 */
-			g_object_unref (new_auth);
-			return TRUE;
-		}
-
 		/* The server didn't like the username/password we
 		 * provided before. Invalidate it and note this fact.
 		 */
@@ -767,7 +758,7 @@
 	if (!headers)
 		return;
 
-	if (update_auth_internal (session, msg, headers, proxy, TRUE))
+	if (update_auth_internal (session, msg, headers, proxy))
 		soup_session_requeue_message (session, msg);
 }
 
@@ -814,6 +805,9 @@
 		soup_message_remove_header (msg->request_headers, header);
 		soup_message_add_header (msg->request_headers, header, token);
 		g_free (token);
+		g_object_set_data_full (G_OBJECT (msg),
+					proxy ? "SoupSession-proxyauth" : "SoupSession-auth",
+					g_object_ref (auth), g_object_unref);
 	}
 }
 
