diff options
author | Alex Graveley <alex@ximian.com> | 2001-10-19 21:57:27 +0000 |
---|---|---|
committer | Alex Graveley <orph@src.gnome.org> | 2001-10-19 21:57:27 +0000 |
commit | 1af6cdf856ed7a019c2ed5f5e9a51b8a8fdde7e0 (patch) | |
tree | 87dac1af427679e8b6bcb5f880ea5e1ef22aea3b /libsoup/soup-queue.c | |
parent | 33e048884df2fd69202688f8e0a97c78f1aef786 (diff) | |
download | libsoup-1af6cdf856ed7a019c2ed5f5e9a51b8a8fdde7e0.tar.gz |
This is the first attempt at authentication inheritence, it still needs
2001-10-19 Alex Graveley <alex@ximian.com>
This is the first attempt at authentication inheritence, it
still needs some work. Auth headers are always sent no matter
what, auth realms are not respected, and auth data in the uri is
ignored unless an existing auth attempt fails.
* src/libsoup/soup-auth.c (digest_parse_func): Compute a1 hash
"user:realm:passwd:nonce:cnonce" here, to cut down on per-request
overhead. Accept a SoupUri from which to get auth info.
(basic_parse_func): Base64 encode user:passwd here for same
reason. Accept a SoupUri for getting auth info.
(compute_response): Get uri path from message instead of SoupAuth.
(digest_auth_func): Ditto.
(soup_auth_lookup): Impl. Given a context, lookup the SoupAuth of
the nearest parent directory.
(soup_auth_set_context): Impl. Register a SoupAuth to be used for
requests to the context's path and subdirectories.
* src/libsoup/soup-auth.h: Move define of SoupAuth here, in
preparation for making public eventually.
* src/libsoup/soup-queue.c (soup_encode_http_auth): Use
soup_auth_lookup ().
(soup_get_request_header): Don't check the request's uri for auth
info, as a parent context may have a valid registered SoupAuth.
* src/libsoup/soup-message.c (authorize_handler): Use
soup_auth_lookup() to find last (failing) SoupAuth. Use
soup_auth_set_context() to register the created SoupAuth for this
context.
* src/libsoup/soup-message.h: Explicitly define values for soup
transport-level errorcodes, just because.
* src/libsoup/soup-context.c (soup_context_unref): When freeing
the SoupHost parent of this context, free all associated
SoupAuths.
* src/libsoup/soup-private.h: Remove auth pointer from context,
add hashtable of valid auths to SoupAuth.
Diffstat (limited to 'libsoup/soup-queue.c')
-rw-r--r-- | libsoup/soup-queue.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libsoup/soup-queue.c b/libsoup/soup-queue.c index 6cd8a60b..674dcb78 100644 --- a/libsoup/soup-queue.c +++ b/libsoup/soup-queue.c @@ -242,22 +242,22 @@ soup_queue_read_done_cb (const SoupDataBuffer *data, static void soup_encode_http_auth (SoupMessage *msg, GString *header, gboolean proxy_auth) { + SoupAuth *auth; SoupContext *ctx; char *token; ctx = proxy_auth ? soup_get_proxy () : msg->context; - if (ctx->auth) { - token = soup_auth_authorize (ctx->auth, msg); + auth = soup_auth_lookup (ctx); + if (auth) { + token = soup_auth_authorize (auth, msg); if (token) { - g_string_sprintfa ( - header, - "%s: %s\r\n", - proxy_auth ? - "Proxy-Authorization" : - "Authorization", - token); - + g_string_sprintfa (header, + "%s: %s\r\n", + proxy_auth ? + "Proxy-Authorization" : + "Authorization", + token); g_free (token); } } @@ -393,7 +393,7 @@ soup_get_request_header (SoupMessage *req) /* * Authorization from the context Uri */ - if (!hdrs.auth && suri->user) + if (!hdrs.auth) soup_encode_http_auth (req, header, FALSE); g_string_append (header, "\r\n"); |