summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDebarshi Ray <debarshir@gnome.org>2015-10-02 12:41:34 +0200
committerDebarshi Ray <debarshir@gnome.org>2015-10-02 18:21:49 +0200
commit210878ba073be6bfffd3c9a6265164fbaf118f94 (patch)
treed5979dbc658e272c8af7080e38136f14ed5a59ff
parent79995b6789c89dc9bbe8514428045e8a151c78f6 (diff)
downloadlibgdata-210878ba073be6bfffd3c9a6265164fbaf118f94.tar.gz
core: GDataDownloadStream:content-length should consider Content-Range
https://bugzilla.gnome.org/show_bug.cgi?id=755976
-rw-r--r--gdata/gdata-download-stream.c7
1 files changed, 7 insertions, 0 deletions
diff --git a/gdata/gdata-download-stream.c b/gdata/gdata-download-stream.c
index b43d67d7..67a3514b 100644
--- a/gdata/gdata-download-stream.c
+++ b/gdata/gdata-download-stream.c
@@ -814,6 +814,10 @@ gdata_download_stream_truncate (GSeekable *seekable, goffset offset, GCancellabl
static void
got_headers_cb (SoupMessage *message, GDataDownloadStream *self)
{
+ goffset end;
+ goffset start;
+ goffset total_length;
+
/* Don't get the client's hopes up by setting the Content-Type or -Length if the response
* is actually unsuccessful. */
if (SOUP_STATUS_IS_SUCCESSFUL (message->status_code) == FALSE)
@@ -822,6 +826,9 @@ got_headers_cb (SoupMessage *message, GDataDownloadStream *self)
g_mutex_lock (&(self->priv->content_mutex));
self->priv->content_type = g_strdup (soup_message_headers_get_content_type (message->response_headers, NULL));
self->priv->content_length = soup_message_headers_get_content_length (message->response_headers);
+ if (soup_message_headers_get_content_range (message->response_headers, &start, &end, &total_length)) {
+ self->priv->content_length = (gssize) total_length;
+ }
g_mutex_unlock (&(self->priv->content_mutex));
/* Emit the notifications for the Content-Length and -Type properties */