From cd1d443439e3131d4cb27175345424702c38ac8a Mon Sep 17 00:00:00 2001 From: Milan Crha Date: Mon, 30 Jan 2012 18:05:17 +0100 Subject: Bug #669005 - Partial hang with unresponsive HTML email image source --- mail/em-format-html.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'mail') diff --git a/mail/em-format-html.c b/mail/em-format-html.c index 107c2ce267..5406223f10 100644 --- a/mail/em-format-html.c +++ b/mail/em-format-html.c @@ -1595,7 +1595,6 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, { CamelStream *cistream = NULL, *costream = NULL, *instream = NULL; CamelURL *url; - CamelContentType *content_type; CamelHttpStream *tmp_stream; gssize n, total = 0, pc_complete = 0, nread = 0; gchar buffer[1500]; @@ -1636,12 +1635,16 @@ emfh_gethttp (struct _EMFormatHTMLJob *job, camel_operation_push_message ( cancellable, _("Retrieving '%s'"), job->u.uri); tmp_stream = (CamelHttpStream *) instream; - content_type = camel_http_stream_get_content_type (tmp_stream); - length = camel_header_raw_find(&tmp_stream->headers, "Content-Length", NULL); - d(printf(" Content-Length: %s\n", length)); - if (length != NULL) - total = atoi (length); - camel_content_type_unref (content_type); + if (camel_stream_read (CAMEL_STREAM (instream), NULL, 0, cancellable, NULL) == 0) { + CamelContentType *content_type; + + content_type = camel_http_stream_get_content_type (tmp_stream); + length = camel_header_raw_find(&tmp_stream->headers, "Content-Length", NULL); + d(printf(" Content-Length: %s\n", length)); + if (length != NULL) + total = atoi (length); + camel_content_type_unref (content_type); + } } else camel_operation_push_message ( cancellable, _("Retrieving '%s'"), job->u.uri); -- cgit v1.2.3