[rygel] core: HTTItemURI creates the whole URI



commit b145a36c4e8d19bbce1ccf56bda3a7e3b616512d
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Mon Jan 25 18:57:27 2010 +0200

    core: HTTItemURI creates the whole URI
    
    Some parts of URI creation was still in HTTPServer.

 src/rygel/rygel-http-item-uri.vala |   15 +++++++++++----
 src/rygel/rygel-http-server.vala   |    9 +--------
 2 files changed, 12 insertions(+), 12 deletions(-)
---
diff --git a/src/rygel/rygel-http-item-uri.vala b/src/rygel/rygel-http-item-uri.vala
index 3569d8a..68d04ec 100644
--- a/src/rygel/rygel-http-item-uri.vala
+++ b/src/rygel/rygel-http-item-uri.vala
@@ -79,15 +79,22 @@ internal class Rygel.HTTPItemURI : Object {
         var escaped = Uri.escape_string (Base64.encode ((uchar[]) data),
                                          "",
                                          true);
-        string query = "/item/" + escaped;
+        string path = "/item/" + escaped;
 
         if (transcode_target != null) {
             escaped = Uri.escape_string (transcode_target, "", true);
-            query += "/transcoded/" + escaped;
+            path += "/transcoded/" + escaped;
         } else if (thumbnail_index >= 0) {
-            query += "/thumbnail/" + thumbnail_index.to_string ();
+            path += "/thumbnail/" + thumbnail_index.to_string ();
         }
 
-        return query;
+        return this.create_uri_for_path (path);
+    }
+
+    private string create_uri_for_path (string path) {
+        return "http://%s:%u%s%s".printf (this.http_server.context.host_ip,
+                                          this.http_server.context.port,
+                                          this.http_server.path_root,
+                                          path);
     }
 }
diff --git a/src/rygel/rygel-http-server.vala b/src/rygel/rygel-http-server.vala
index aac14d9..c4be370 100644
--- a/src/rygel/rygel-http-server.vala
+++ b/src/rygel/rygel-http-server.vala
@@ -115,13 +115,6 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
         this.completed ();
     }
 
-    private string create_uri_for_path (string path) {
-        return "http://%s:%u%s%s".printf (this.context.host_ip,
-                                          this.context.port,
-                                          this.path_root,
-                                          path);
-    }
-
     internal override string create_uri_for_item (MediaItem item,
                                                   int       thumbnail_index,
                                                   string?   transcode_target) {
@@ -130,7 +123,7 @@ internal class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
                                    thumbnail_index,
                                    transcode_target);
 
-        return create_uri_for_path (uri.to_string());
+        return uri.to_string ();
     }
 
     internal override string get_protocol () {



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