[rygel] core: HTTPSeek sets all related headers



commit b9d96e2f1a9ff9d44d1e505ac8cc00e768b2e634
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Tue Dec 8 17:42:48 2009 +0200

    core: HTTPSeek sets all related headers
    
    HTTPSeek should be setting all headers related to seeking.

 src/rygel/rygel-http-identity-handler.vala |   21 ++++-----------------
 src/rygel/rygel-http-seek.vala             |    1 +
 2 files changed, 5 insertions(+), 17 deletions(-)
---
diff --git a/src/rygel/rygel-http-identity-handler.vala b/src/rygel/rygel-http-identity-handler.vala
index e171b1f..4a681bb 100644
--- a/src/rygel/rygel-http-identity-handler.vala
+++ b/src/rygel/rygel-http-identity-handler.vala
@@ -32,20 +32,12 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
 
     public override void add_response_headers (HTTPRequest request)
                                                throws HTTPRequestError {
-        long size;
-        string mime_type;
-
         if (request.thumbnail != null) {
-            size = request.thumbnail.size;
-            mime_type= request.thumbnail.mime_type;
+            request.msg.response_headers.append ("Content-Type",
+                                                 request.thumbnail.mime_type);
         } else {
-            size = request.item.size;
-            mime_type= request.item.mime_type;
-        }
-
-        request.msg.response_headers.append ("Content-Type", mime_type);
-        if (size >= 0) {
-            request.msg.response_headers.set_content_length (size);
+            request.msg.response_headers.append ("Content-Type",
+                                                 request.item.mime_type);
         }
 
         if (request.thumbnail == null && request.item.should_stream ()) {
@@ -53,12 +45,7 @@ internal class Rygel.HTTPIdentityHandler : Rygel.HTTPRequestHandler {
                 request.time_range.add_response_headers ();
             }
         } else {
-            request.msg.response_headers.append ("Accept-Ranges", "bytes");
             if (request.byte_range != null) {
-                var length = request.byte_range.length;
-                if (length > 0) {
-                    request.msg.response_headers.set_content_length (length);
-                }
                 request.byte_range.add_response_headers ();
             }
         }
diff --git a/src/rygel/rygel-http-seek.vala b/src/rygel/rygel-http-seek.vala
index 45a636b..a8ccd2f 100644
--- a/src/rygel/rygel-http-seek.vala
+++ b/src/rygel/rygel-http-seek.vala
@@ -185,6 +185,7 @@ internal class Rygel.HTTPSeek : GLib.Object {
             start = (double) this.start;
             stop = (double) this.stop;
 
+            this.msg.response_headers.append ("Accept-Ranges", "bytes");
         }
 
         value += start.to_string () + "-";



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