** Fix for bug #376425
authorMilan Crha <mcrha@redhat.com>
Thu, 22 Nov 2007 07:12:57 +0000 (07:12 +0000)
committerMilan Crha <mcrha@src.gnome.org>
Thu, 22 Nov 2007 07:12:57 +0000 (07:12 +0000)
2007-11-22  Milan Crha  <mcrha@redhat.com>

** Fix for bug #376425

* camel-http-stream.c: (camel_http_stream_get_content_type):
Use proxy if user uses it.
* camel-http-stream.c: (camel_http_stream_set_proxy):
Do not crash if have proxy without name and password.

svn path=/trunk/; revision=8229

camel/ChangeLog
camel/camel-http-stream.c

index 2d77aed..adef085 100644 (file)
@@ -1,3 +1,12 @@
+2007-11-22  Milan Crha  <mcrha@redhat.com>
+
+       ** Fix for bug #376425
+
+       * camel-http-stream.c: (camel_http_stream_get_content_type):
+       Use proxy if user uses it.
+       * camel-http-stream.c: (camel_http_stream_set_proxy):
+       Do not crash if have proxy without name and password.
+
 2007-11-15  Matthew Barnes  <mbarnes@redhat.com>
 
        ** Fixes part of bug #474000
index 5ede95f..b36515c 100644 (file)
@@ -540,7 +540,7 @@ camel_http_stream_get_content_type (CamelHttpStream *http_stream)
        g_return_val_if_fail (CAMEL_IS_HTTP_STREAM (http_stream), NULL);
 
        if (!http_stream->content_type && !http_stream->raw) {
-               if (http_connect (http_stream, http_stream->url) == NULL)
+               if (http_connect (http_stream, http_stream->proxy ? http_stream->proxy : http_stream->url) == NULL)
                        return NULL;
 
                if (http_method_invoke (http_stream) == -1)
@@ -578,7 +578,7 @@ camel_http_stream_set_proxy (CamelHttpStream *http_stream, const char *proxy_url
        else
                http_stream->proxy = camel_url_new (proxy_url, NULL);
 
-       if (http_stream->proxy) {
+       if (http_stream->proxy && ((http_stream->proxy->user && *http_stream->proxy->user) || (http_stream->proxy->passwd && *http_stream->proxy->passwd))) {
                char *basic, *basic64;
 
                basic = g_strdup_printf("%s:%s", http_stream->proxy->user?http_stream->proxy->user:"",