[gvfs/gnome-3-14] http: Report correct size for partial content msg
- From: Ondrej Holy <oholy src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gvfs/gnome-3-14] http: Report correct size for partial content msg
- Date: Wed, 3 Dec 2014 07:56:51 +0000 (UTC)
commit 643498c51747d2b0ff2290352afdac97a9771e02
Author: Ondrej Holy <oholy redhat com>
Date: Mon Nov 24 14:21:39 2014 +0100
http: Report correct size for partial content msg
Content length is wrongly used as file size for partial content
messages (e.g. after seek), therefor length from range header has
to be used instead.
https://bugzilla.gnome.org/show_bug.cgi?id=690226
daemon/gvfsbackendhttp.c | 19 +++++++++++++++++--
1 files changed, 17 insertions(+), 2 deletions(-)
---
diff --git a/daemon/gvfsbackendhttp.c b/daemon/gvfsbackendhttp.c
index 2056a4a..cde0293 100644
--- a/daemon/gvfsbackendhttp.c
+++ b/daemon/gvfsbackendhttp.c
@@ -540,8 +540,23 @@ file_info_from_message (SoupMessage *msg,
g_free (basename);
g_free (ed_name);
- if (soup_message_headers_get_encoding(msg->response_headers) == SOUP_ENCODING_CONTENT_LENGTH)
- g_file_info_set_size (info, soup_message_headers_get_content_length (msg->response_headers));
+ if (soup_message_headers_get_encoding (msg->response_headers) == SOUP_ENCODING_CONTENT_LENGTH)
+ {
+ goffset start, end, length;
+ gboolean ret;
+
+ ret = soup_message_headers_get_content_range (msg->response_headers,
+ &start, &end, &length);
+ if (ret && length != -1)
+ {
+ g_file_info_set_size (info, length);
+ }
+ else if (!ret)
+ {
+ length = soup_message_headers_get_content_length (msg->response_headers);
+ g_file_info_set_size (info, length);
+ }
+ }
text = soup_message_headers_get_content_type (msg->response_headers, NULL);
if (text)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]