SoupAuthDigest, SoupAuthDomainDigest: follow the spec more precisely
authorDan Winship <danw@gnome.org>
Sat, 19 Dec 2009 11:59:13 +0000 (12:59 +0100)
committerDan Winship <danw@gnome.org>
Sat, 19 Dec 2009 11:59:13 +0000 (12:59 +0100)
Some implementations apparently require you to precisely follow the spec
in terms of whether particular attribute values are quoted or non-quoted.

Probably fixes https://bugzilla.gnome.org/show_bug.cgi?id=582219

libsoup/soup-auth-digest.c
libsoup/soup-auth-domain-digest.c

index 2299ae7..f9c88bc 100644 (file)
@@ -445,7 +445,7 @@ get_authorization (SoupAuth *auth, SoupMessage *msg)
        soup_header_g_string_append_param (out, "uri", url);
        g_string_append (out, ", ");
        algorithm = soup_auth_digest_get_algorithm (priv->algorithm);
-       soup_header_g_string_append_param (out, "algorithm", algorithm);
+       g_string_append_printf (out, "algorithm=%s", algorithm);
        g_free (algorithm);
        g_string_append (out, ", ");
        soup_header_g_string_append_param (out, "response", response);
@@ -460,9 +460,8 @@ get_authorization (SoupAuth *auth, SoupMessage *msg)
 
                g_string_append (out, ", ");
                soup_header_g_string_append_param (out, "cnonce", priv->cnonce);
-               g_string_append_printf (out, ", nc=\"%.8x\"", priv->nc);
-               g_string_append (out, ", ");
-               soup_header_g_string_append_param (out, "qop", qop);
+               g_string_append_printf (out, ", nc=%.8x, qop=%s",
+                                       priv->nc, qop);
                g_free (qop);
        }
 
index e5e3164..f4a7f41 100644 (file)
@@ -379,7 +379,7 @@ challenge (SoupAuthDomain *domain, SoupMessage *msg)
                                (unsigned long) msg,
                                (unsigned long) time (0));
        g_string_append_printf (str, ", qop=\"auth\"");
-       g_string_append_printf (str, ", algorithm=\"MD5\"");
+       g_string_append_printf (str, ", algorithm=MD5");
 
        return g_string_free (str, FALSE);
 }