[gvfs] http: Allow seek past end of file



commit fbcd75035e89c9431c9e1512e02e54ac8b5200d0
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 322d343..f96f52d 100644
--- a/daemon/gvfshttpinputstream.c
+++ b/daemon/gvfshttpinputstream.c
@@ -338,6 +338,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]