From 7e0f96133ca897640be51c3f4039dd90188357da Mon Sep 17 00:00:00 2001 From: Ross Lagerwall Date: Sun, 8 Dec 2013 13:01:40 +0200 Subject: 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 --- daemon/gvfshttpinputstream.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) 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; -- cgit v1.2.1