[rygel] core: Refactor HTTPGet.handle() a bit



commit 6d4003290f8e41177301cf717eda12bb9db914dc
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Thu Aug 19 17:31:02 2010 +0300

    core: Refactor HTTPGet.handle() a bit

 src/rygel/rygel-http-get.vala |   24 ++++++++++++++----------
 1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/src/rygel/rygel-http-get.vala b/src/rygel/rygel-http-get.vala
index d1eb33e..2b4f119 100644
--- a/src/rygel/rygel-http-get.vala
+++ b/src/rygel/rygel-http-get.vala
@@ -69,16 +69,7 @@ internal class Rygel.HTTPGet : HTTPRequest {
         if (this.handler == null) {
             this.handler = new HTTPIdentityHandler (this.cancellable);
 
-            header = this.msg.request_headers.get_one (TRANSFER_MODE_HEADER);
-
-            if (header == "Streaming" &&
-                (!this.item.should_stream () ||
-                 this.subtitle != null ||
-                 this.thumbnail != null)) {
-                throw new HTTPRequestError.UNACCEPTABLE (
-                                        "Streaming mode not supported for '%s'",
-                                        item.id);
-            }
+            this.ensure_correct_mode ();
         }
 
         yield this.handle_item_request ();
@@ -131,5 +122,18 @@ internal class Rygel.HTTPGet : HTTPRequest {
 
         this.end (Soup.KnownStatusCode.NONE);
     }
+
+    private void ensure_correct_mode () throws HTTPRequestError {
+        var mode = this.msg.request_headers.get_one (TRANSFER_MODE_HEADER);
+
+        if (mode == "Streaming" &&
+            (!this.item.should_stream () ||
+             this.subtitle != null ||
+             this.thumbnail != null)) {
+            throw new HTTPRequestError.UNACCEPTABLE (
+                                        "Streaming mode not supported for '%s'",
+                                        item.id);
+        }
+    }
 }
 



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