[rygel] core: Error on 'interactive' request for streams



commit b32a5831a2bc50e4bf9d7b51c01b4267ed3fb816
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Aug 19 18:17:44 2010 +0300

    core: Error on 'interactive' request for streams
    
    Throw an error on 'interactive' download request for streaming content.
    This satisfies DLNA requirement 7.4.49.4.

 src/rygel/rygel-http-get.vala |   32 ++++++++++++++++++++++++--------
 1 files changed, 24 insertions(+), 8 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index 2b4f119..5f16859 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -68,10 +68,10 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
         if (this.handler == null) {
             this.handler = new HTTPIdentityHandler (this.cancellable);
-
-            this.ensure_correct_mode ();
         }
 
+        this.ensure_correct_mode ();
+
         yield this.handle_item_request ();
     }
 
@@ -125,14 +125,30 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
     private void ensure_correct_mode () throws HTTPRequestError {
         var mode = this.msg.request_headers.get_one (TRANSFER_MODE_HEADER);
+        var incorrect = false;
+
+        switch (mode) {
+        case "Streaming":
+            incorrect = this.handler is HTTPIdentityHandler &&
+                        (!this.item.should_stream () ||
+                         this.subtitle != null ||
+                         this.thumbnail != null);
+
+            break;
+        case "Interactive":
+            incorrect =  this.handler is HTTPTranscodeHandler ||
+                         (this.item.should_stream () &&
+                          this.subtitle == null &&
+                          this.thumbnail == null);
+
+            break;
+        }
 
-        if (mode == "Streaming" &&
-            (!this.item.should_stream () ||
-             this.subtitle != null ||
-             this.thumbnail != null)) {
+        if (incorrect) {
             throw new HTTPRequestError.UNACCEPTABLE (
-                                        "Streaming mode not supported for '%s'",
-                                        item.id);
+                                        "%s mode not supported for '%s'",
+                                        mode,
+                                        this.item.id);
         }
     }
 }



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