summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRoss Lagerwall <rosslagerwall@gmail.com>2013-12-08 13:01:40 +0200
committerRoss Lagerwall <rosslagerwall@gmail.com>2013-12-08 13:15:57 +0200
commit7e0f96133ca897640be51c3f4039dd90188357da (patch)
tree16624934ce3ee41a8f004b92d63e7086fc136c6e
parent06b5820152e6b4647ef63cc2498511fbed6d4806 (diff)
downloadgvfs-7e0f96133ca897640be51c3f4039dd90188357da.tar.gz
http: Fix the SEEK_END offset calculation
Fix the SEEK_END offset calculation by reversing the sign of offset and taking into account the offset of the previous seek. https://bugzilla.gnome.org/show_bug.cgi?id=710534
-rw-r--r--daemon/gvfshttpinputstream.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/daemon/gvfshttpinputstream.c b/daemon/gvfshttpinputstream.c
index a6ef3e0b..322d343f 100644
--- a/daemon/gvfshttpinputstream.c
+++ b/daemon/gvfshttpinputstream.c
@@ -43,6 +43,7 @@ typedef struct {
GInputStream *stream;
char *range;
+ goffset request_offset;
goffset offset;
} GVfsHttpInputStreamPrivate;
@@ -474,7 +475,7 @@ g_vfs_http_input_stream_seek (GSeekable *seekable,
if (content_length)
{
type = G_SEEK_SET;
- offset = content_length - offset;
+ offset = priv->request_offset + content_length + offset;
}
}
@@ -510,6 +511,7 @@ g_vfs_http_input_stream_seek (GSeekable *seekable,
case G_SEEK_SET:
priv->range = g_strdup_printf ("bytes=%"G_GUINT64_FORMAT"-", (guint64)offset);
+ priv->request_offset = offset;
priv->offset = offset;
break;