diff options
Diffstat (limited to 'mail/em-format-html.c')
-rw-r--r-- | mail/em-format-html.c | 52 |
1 files changed, 43 insertions, 9 deletions
diff --git a/mail/em-format-html.c b/mail/em-format-html.c index a1be319390..f3209b8b89 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -40,13 +40,14 @@ #undef interface #endif -#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */ +#include <libebackend/e-extensible.h> #include <libedataserver/e-time-utils.h> +#include <libedataserver/e-data-server-util.h> /* for e_utf8_strftime, what about e_time_format_time? */ + #include "e-util/e-datetime-format.h" #include "e-util/e-icon-factory.h" #include "e-util/e-util-private.h" #include "e-util/e-util.h" -#include "e-util/e-extensible.h" #include "misc/e-web-view.h" #include <shell/e-shell.h> @@ -1511,6 +1512,43 @@ emfh_getpuri (struct _EMFormatHTMLJob *job, } static void +emfh_configure_stream_for_proxy (CamelHttpStream *stream, + const gchar *uri) +{ + EProxy *proxy; + SoupURI *proxy_uri; + gchar *basic; + gchar *basic64; + const gchar *user = ""; + const gchar *password = ""; + + proxy = em_utils_get_proxy (); + + if (!e_proxy_require_proxy_for_uri (proxy, uri)) + return; + + proxy_uri = e_proxy_peek_uri_for (proxy, uri); + + if (proxy_uri == NULL) + return; + + if (proxy_uri->user != NULL) + user = proxy_uri->user; + + if (proxy_uri->password != NULL) + password = proxy_uri->password; + + if (*user == '\0' && *password == '\0') + return; + + basic = g_strdup_printf ("%s:%s", user, password); + basic64 = g_base64_encode ((guchar *) basic, strlen (basic)); + camel_http_stream_set_proxy_authpass (stream, basic64); + g_free (basic64); + g_free (basic); +} + +static void emfh_gethttp (struct _EMFormatHTMLJob *job, GCancellable *cancellable) { @@ -1533,7 +1571,6 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, if (instream == NULL) { EMailImageLoadingPolicy policy; - gchar *proxy; policy = em_format_html_get_image_loading_policy (job->format); @@ -1552,12 +1589,9 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, } instream = camel_http_stream_new (CAMEL_HTTP_METHOD_GET, ((EMFormat *) job->format)->session, url); - camel_http_stream_set_user_agent((CamelHttpStream *)instream, "CamelHttpStream/1.0 Evolution/" VERSION); - proxy = em_utils_get_proxy_uri (job->u.uri); - if (proxy) { - camel_http_stream_set_proxy ((CamelHttpStream *) instream, proxy); - g_free (proxy); - } + camel_http_stream_set_user_agent((CamelHttpStream *) instream, "CamelHttpStream/1.0 Evolution/" VERSION); + emfh_configure_stream_for_proxy ((CamelHttpStream *) instream, job->u.uri); + camel_operation_push_message ( cancellable, _("Retrieving '%s'"), job->u.uri); tmp_stream = (CamelHttpStream *) instream; |