[evolution-patches] 66199, camel, proxy auth
- From: Not Zed <notzed ximian com>
- To: asdf <evolution-patches lists ximian com>
- Subject: [evolution-patches] 66199, camel, proxy auth
- Date: Tue, 21 Sep 2004 14:17:08 +0800
Implements "Basic" proxy auth in camel-http-stream, and fixes up relative url redirects.
The old soup stuff was removed years ago because it was to buggy at the time, and then the code changed and required synchronous, thread-safe api's which didn't exist yet.
Index: camel/ChangeLog
===================================================================
RCS file: /cvs/gnome/evolution/camel/ChangeLog,v
retrieving revision 1.2251.2.2
diff -u -3 -r1.2251.2.2 ChangeLog
--- camel/ChangeLog 20 Sep 2004 08:10:23 -0000 1.2251.2.2
+++ camel/ChangeLog 21 Sep 2004 06:18:06 -0000
@@ -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-15 Not Zed <NotZed Ximian com>
** See bug #0xffff.
Index: camel/camel-http-stream.c
===================================================================
RCS file: /cvs/gnome/evolution/camel/camel-http-stream.c,v
retrieving revision 1.16
diff -u -3 -r1.16 camel-http-stream.c
--- camel/camel-http-stream.c 23 Oct 2003 19:57:58 -0000 1.16
+++ camel/camel-http-stream.c 21 Sep 2004 06:18:06 -0000
@@ -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_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 @@
case 301:
case 302: {
char *loc;
+ CamelURL *url;
camel_content_type_unref (http->content_type);
http->content_type = NULL;
@@ -445,10 +447,13 @@
/* 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 @@
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
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]