summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan Winship <danw@src.gnome.org>2002-04-02 16:22:05 +0000
committerDan Winship <danw@src.gnome.org>2002-04-02 16:22:05 +0000
commit7fe12f0f777822b82840a00e97cf805e9a61f03a (patch)
treeb407e7c3b9e48b19496ccb52bd07af33d4a1a65c
parent839e0bdc0c42a5125b7cab7e20190225de14c9e5 (diff)
downloadlibsoup-7fe12f0f777822b82840a00e97cf805e9a61f03a.tar.gz
Make this take a SoupUri, and if the uri specifies an authmech, use that
* src/libsoup/soup-auth.c (soup_auth_new_from_header_list): Make this take a SoupUri, and if the uri specifies an authmech, use that regardless of strength. * src/libsoup/soup-message.c (authorize_handler): Pass the context's uri to soup_auth_new_from_header_list
-rw-r--r--ChangeLog9
-rw-r--r--libsoup/soup-auth.c16
-rw-r--r--libsoup/soup-auth.h3
-rw-r--r--libsoup/soup-message.c2
4 files changed, 25 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 39ab9ccb..559279ee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2002-04-01 Dan Winship <danw@ximian.com>
+
+ * src/libsoup/soup-auth.c (soup_auth_new_from_header_list): Make
+ this take a SoupUri, and if the uri specifies an authmech, use
+ that regardless of strength.
+
+ * src/libsoup/soup-message.c (authorize_handler): Pass the
+ context's uri to soup_auth_new_from_header_list
+
2002-03-20 Alex Graveley <alex@ximian.com>
* configure.in, src/libsoup/soup-private.h: Bump version to 0.7.1.
diff --git a/libsoup/soup-auth.c b/libsoup/soup-auth.c
index dd282925..634425c6 100644
--- a/libsoup/soup-auth.c
+++ b/libsoup/soup-auth.c
@@ -673,7 +673,8 @@ static AuthScheme known_auth_schemes [] = {
};
SoupAuth *
-soup_auth_new_from_header_list (const GSList *vals)
+soup_auth_new_from_header_list (const SoupUri *uri,
+ const GSList *vals)
{
gchar *header = NULL;
AuthScheme *scheme = NULL, *iter;
@@ -682,9 +683,17 @@ soup_auth_new_from_header_list (const GSList *vals)
g_return_val_if_fail (vals != NULL, NULL);
while (vals) {
- for (iter = known_auth_schemes; iter->scheme; iter++) {
- gchar *tryheader = vals->data;
+ gchar *tryheader = vals->data;
+ for (iter = known_auth_schemes; iter->scheme; iter++) {
+ if (uri->authmech &&
+ !g_strncasecmp (uri->authmech,
+ iter->scheme,
+ strlen (iter->scheme))) {
+ header = tryheader;
+ scheme = iter;
+ goto found;
+ }
if (!g_strncasecmp (tryheader,
iter->scheme,
strlen (iter->scheme))) {
@@ -703,6 +712,7 @@ soup_auth_new_from_header_list (const GSList *vals)
if (!scheme) return NULL;
+ found:
auth = scheme->ctor ();
if (!auth) return NULL;
diff --git a/libsoup/soup-auth.h b/libsoup/soup-auth.h
index 75a49459..c2e75c7a 100644
--- a/libsoup/soup-auth.h
+++ b/libsoup/soup-auth.h
@@ -40,7 +40,8 @@ SoupAuth *soup_auth_lookup (SoupContext *ctx);
void soup_auth_set_context (SoupAuth *auth,
SoupContext *ctx);
-SoupAuth *soup_auth_new_from_header_list (const GSList *header);
+SoupAuth *soup_auth_new_from_header_list (const SoupUri *uri,
+ const GSList *header);
void soup_auth_initialize (SoupAuth *auth,
const SoupUri *uri);
diff --git a/libsoup/soup-message.c b/libsoup/soup-message.c
index 1614a041..77d8f054 100644
--- a/libsoup/soup-message.c
+++ b/libsoup/soup-message.c
@@ -780,7 +780,7 @@ authorize_handler (SoupMessage *msg, gboolean proxy)
"WWW-Authenticate");
if (!vals) goto THROW_CANT_AUTHENTICATE;
- auth = soup_auth_new_from_header_list (vals);
+ auth = soup_auth_new_from_header_list (uri, vals);
if (!auth) {
soup_message_set_error_full (
msg,