diff options
author | Not Zed <NotZed@Ximian.com> | 2004-09-22 09:06:27 +0800 |
---|---|---|
committer | Michael Zucci <zucchi@src.gnome.org> | 2004-09-22 09:06:27 +0800 |
commit | 6154276434c5616201d022079107af590b130c7e (patch) | |
tree | 0a35246b512d64ff3f0fe1d1da7db0c931e454b2 | |
parent | 5cbb876604b359b367e4bd76ff2bb20eefbca27b (diff) | |
download | gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar.gz gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar.bz2 gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar.lz gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar.xz gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.tar.zst gsoc2013-evolution-6154276434c5616201d022079107af590b130c7e.zip |
** See bug #66199.
2004-09-21 Not Zed <NotZed@Ximian.com>
** See bug #66199.
* camel-http-stream.c (stream_read): handle relative url's in
redirect.
(camel_http_stream_set_proxy): generate the basic auth token for
basic proxy auth if we have a user and password.
* camel-http-stream.c: turn off debug.
svn path=/trunk/; revision=27326
-rw-r--r-- | camel/ChangeLog | 11 | ||||
-rw-r--r-- | camel/camel-http-stream.c | 30 |
2 files changed, 36 insertions, 5 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog index 3220642ade..3b630aaf6b 100644 --- a/camel/ChangeLog +++ b/camel/ChangeLog @@ -1,3 +1,14 @@ +2004-09-21 Not Zed <NotZed@Ximian.com> + + ** See bug #66199. + + * camel-http-stream.c (stream_read): handle relative url's in + redirect. + (camel_http_stream_set_proxy): generate the basic auth token for + basic proxy auth if we have a user and password. + + * camel-http-stream.c: turn off debug. + 2004-09-08 Hannah & Fazlu <hannah_lins@yahoo.co.in> Fixes Bug#61088 diff --git a/camel/camel-http-stream.c b/camel/camel-http-stream.c index b754422a3a..5937c23f79 100644 --- a/camel/camel-http-stream.c +++ b/camel/camel-http-stream.c @@ -20,7 +20,6 @@ * */ - #ifdef HAVE_CONFIG_H #include <config.h> #endif @@ -43,8 +42,7 @@ #include "camel-session.h" #include "camel-service.h" /* for hostname stuff */ -#define d(x) x - +#define d(x) static CamelStreamClass *parent_class = NULL; @@ -380,6 +378,9 @@ http_method_invoke (CamelHttpStream *http) http_disconnect(http); return -1; } + + if (http->authpass && http->proxy) + d(printf("HTTP Stream Sending: Proxy-Aurhorization: Basic %s\n", http->authpass)); if (http->authpass && http->proxy && camel_stream_printf (http->raw, "Proxy-Authorization: Basic %s\r\n", http->authpass) == -1) { @@ -431,6 +432,7 @@ stream_read (CamelStream *stream, char *buffer, size_t n) case 301: case 302: { char *loc; + CamelURL *url; camel_content_type_unref (http->content_type); http->content_type = NULL; @@ -445,10 +447,13 @@ stream_read (CamelStream *stream, char *buffer, size_t n) /* redirect... */ g_strstrip(loc); d(printf("HTTP redirect, location = %s\n", loc)); + url = camel_url_new_with_base(http->url, loc); camel_url_free (http->url); - http->url = camel_url_new(loc, NULL); + http->url = url; + if (url == NULL) + http->url = camel_url_new(loc, NULL); + g_free(loc); if (http->url == NULL) { - printf("redirect url '%s' cannot be parsed\n", loc); camel_header_raw_clear (&http->headers); return -1; } @@ -562,6 +567,21 @@ camel_http_stream_set_proxy (CamelHttpStream *http_stream, const char *proxy_url http_stream->proxy = NULL; else http_stream->proxy = camel_url_new (proxy_url, NULL); + + if (http_stream->proxy) { + char *basic, *basic64; + + basic = g_strdup_printf("%s:%s", http_stream->proxy->user?http_stream->proxy->user:"", + http_stream->proxy->passwd?http_stream->proxy->passwd:""); + basic64 = camel_base64_encode_simple(basic, strlen(basic)); + memset(basic, 0, strlen(basic)); + g_free(basic); + camel_http_stream_set_proxy_authpass(http_stream, basic64); + memset(basic64, 0, strlen(basic64)); + g_free(basic64); + } else { + camel_http_stream_set_proxy_authpass(http_stream, NULL); + } } void |