[gvfs/gnome-3-10] http: Allow seek past end of file



commit 0775a4adee787a5032ed876db1e3bac237e60ed0
Author: Ross Lagerwall <rosslagerwall gmail com>
Date:   Sun Dec 8 13:04:45 2013 +0200

    http: Allow seek past end of file
    
    Handle a read after a seek past the end of the file by ignoring the
    requested range not satisfiable http error (416) and simply returning 0.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=710534

 daemon/gvfshttpinputstream.c |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)
---
diff --git a/daemon/gvfshttpinputstream.c b/daemon/gvfshttpinputstream.c
index 222688a..3101f34 100644
--- a/daemon/gvfshttpinputstream.c
+++ b/daemon/gvfshttpinputstream.c
@@ -340,6 +340,14 @@ read_send_callback (GObject      *object,
     }
   if (!SOUP_STATUS_IS_SUCCESSFUL (priv->msg->status_code))
     {
+      if (priv->msg->status_code == SOUP_STATUS_REQUESTED_RANGE_NOT_SATISFIABLE)
+        {
+          g_input_stream_close (priv->stream, NULL, NULL);
+          g_task_return_int (task, 0);
+          g_clear_object (&priv->stream);
+          g_object_unref (task);
+          return;
+        }
       g_task_return_new_error (task,
                               SOUP_HTTP_ERROR,
                               priv->msg->status_code,


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]