diff options
author | Dan Winship <danw@src.gnome.org> | 2007-11-30 02:27:10 +0000 |
---|---|---|
committer | Dan Winship <danw@src.gnome.org> | 2007-11-30 02:27:10 +0000 |
commit | a283ae769f481518a2be9da17c718b3d7a6ea24b (patch) | |
tree | ef5e20c87fddae1f2f5f6b06f719846b705bc20f /libsoup/soup-session.c | |
parent | a3b3d382c0b5ff6978b9437bd2fe607681d718ba (diff) | |
download | libsoup-bindings.tar.gz |
new opaque type for message headers. Currently still a GHashTablelibsoup-bindings
* libsoup/soup-message-headers.c: new opaque type for message
headers. Currently still a GHashTable underneath, for
backward-compatibility, but that will change in the future.
* libsoup/soup-message.c: Use SoupMessageHeaders. Deprecate the
old header methods
* ...: use SoupMessageHeaders
* python/libsoup.defs: update for SoupMessageHeaders, add fields
to SoupMessage
svn path=/branches/libsoup-bindings/; revision=967
Diffstat (limited to 'libsoup/soup-session.c')
-rw-r--r-- | libsoup/soup-session.c | 29 |
1 files changed, 8 insertions, 21 deletions
diff --git a/libsoup/soup-session.c b/libsoup/soup-session.c index f0fb4281..5d2f57af 100644 --- a/libsoup/soup-session.c +++ b/libsoup/soup-session.c @@ -765,13 +765,11 @@ authenticate_auth (SoupSession *session, SoupAuth *auth, } static gboolean -update_auth_internal (SoupSession *session, SoupMessage *msg, - const GSList *headers, gboolean proxy) +update_auth_internal (SoupSession *session, SoupMessage *msg, gboolean proxy) { SoupSessionHost *host; SoupAuth *new_auth, *prior_auth, *old_auth; gpointer old_path, old_auth_info; - const SoupUri *msg_uri; const char *path; char *auth_info; GSList *pspace, *p; @@ -787,8 +785,9 @@ update_auth_internal (SoupSession *session, SoupMessage *msg, /* Try to construct a new auth from the headers; if we can't, * there's no way we'll be able to authenticate. */ - msg_uri = soup_message_get_uri (msg); - new_auth = soup_auth_new_from_header_list (headers); + new_auth = soup_auth_new_from_headers ( + msg->response_headers, + proxy ? "Proxy-Authenticate" : "WWW-Authenticate"); if (!new_auth) return FALSE; @@ -825,7 +824,7 @@ update_auth_internal (SoupSession *session, SoupMessage *msg, if (proxy) pspace = g_slist_prepend (NULL, g_strdup ("")); else - pspace = soup_auth_get_protection_space (new_auth, msg_uri); + pspace = soup_auth_get_protection_space (new_auth, soup_message_get_uri (msg)); for (p = pspace; p; p = p->next) { path = p->data; @@ -887,22 +886,10 @@ static void authorize_handler (SoupMessage *msg, gpointer user_data) { SoupSession *session = user_data; - const GSList *headers; gboolean proxy; - if (msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED) { - headers = soup_message_get_header_list (msg->response_headers, - "Proxy-Authenticate"); - proxy = TRUE; - } else { - headers = soup_message_get_header_list (msg->response_headers, - "WWW-Authenticate"); - proxy = FALSE; - } - if (!headers) - return; - - if (update_auth_internal (session, msg, headers, proxy)) + proxy = (msg->status_code == SOUP_STATUS_PROXY_AUTHENTICATION_REQUIRED); + if (update_auth_internal (session, msg, proxy)) soup_session_requeue_message (session, msg); } @@ -913,7 +900,7 @@ redirect_handler (SoupMessage *msg, gpointer user_data) const char *new_loc; SoupUri *new_uri; - new_loc = soup_message_get_header (msg->response_headers, "Location"); + new_loc = soup_message_headers_find (msg->response_headers, "Location"); if (!new_loc) return; |