stale=true in digest auth



Hi !

Current library emits REAUTHENTICATE signal when the WWW-authenticate
header contains stale=true. Included a patch which changes this to the
AUTHENTICATE signal which is imo the right behavior.

br, jari
diff -Naur libsoup-2.2.99/libsoup/soup-session.c libsoup-2.2.99-ju/libsoup/soup-session.c
--- libsoup-2.2.99/libsoup/soup-session.c	2007-01-02 20:25:11.000000000 +0200
+++ libsoup-2.2.99-ju/libsoup/soup-session.c	2007-04-20 15:18:21.000000000 +0300
@@ -743,6 +743,26 @@
 }
 
 static gboolean
+auth_digest_is_stale (const GSList *vals)
+{
+	g_return_val_if_fail (vals != NULL, FALSE);
+
+	while (vals) {
+		char *tryheader = vals->data;
+
+		if (!g_ascii_strncasecmp (tryheader, "Digest", 6)) {
+		        char *str = strstr(tryheader, "stale=");
+		        if (str) 
+		        	return !g_ascii_strncasecmp (str + 6, "true", 4);
+		        return FALSE;
+		}
+
+		vals = vals->next;
+	}
+	return FALSE;
+}	
+
+static gboolean
 update_auth_internal (SoupSession *session, SoupMessage *msg,
 		      const GSList *headers, gboolean proxy,
 		      gboolean got_unauthorized)
@@ -790,7 +810,7 @@
 		 * provided before. Invalidate it and note this fact.
 		 */
 		invalidate_auth (host, prior_auth);
-		prior_auth_failed = TRUE;
+		prior_auth_failed = !auth_digest_is_stale(headers);
 	}
 
 	if (!host->auth_realms) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]