[rygel] core: Only advertise internal URIs on lo



commit 48207abd58da73c35cff0cd9308adae42b19b856
Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
Date:   Wed Sep 2 16:32:37 2009 +0300

    core: Only advertise internal URIs on lo
    
    Only advertise internal URIs on loopback interface.

 src/rygel/rygel-didl-lite-writer.vala |    4 +++-
 src/rygel/rygel-media-item.vala       |   12 ++++++++----
 2 files changed, 11 insertions(+), 5 deletions(-)
---
diff --git a/src/rygel/rygel-didl-lite-writer.vala b/src/rygel/rygel-didl-lite-writer.vala
index 97d50e0..2d3165f 100644
--- a/src/rygel/rygel-didl-lite-writer.vala
+++ b/src/rygel/rygel-didl-lite-writer.vala
@@ -88,8 +88,10 @@ internal class Rygel.DIDLLiteWriter : GUPnP.DIDLLiteWriter {
         // Add the transcoded/proxy URIs first
         this.http_server.add_resources (didl_item, item);
 
+        var internal_allowed = this.http_server.context.interface == "lo" ||
+                               this.http_server.context.host_ip == "127.0.0.1";
         // then original URIs
-        item.add_resources (didl_item);
+        item.add_resources (didl_item, internal_allowed);
     }
 
     private void serialize_container (MediaContainer container) throws Error {
diff --git a/src/rygel/rygel-media-item.vala b/src/rygel/rygel-media-item.vala
index 1cfaa21..1e2e2d1 100644
--- a/src/rygel/rygel-media-item.vala
+++ b/src/rygel/rygel-media-item.vala
@@ -107,11 +107,15 @@ public class Rygel.MediaItem : MediaObject {
         return this.size <= 0;
     }
 
-    internal void add_resources (DIDLLiteItem didl_item) throws Error {
+    internal void add_resources (DIDLLiteItem didl_item,
+                                 bool         allow_internal)
+                                 throws Error {
         foreach (var uri in this.uris) {
-            this.add_resource (didl_item,
-                               uri,
-                               this.get_protocol_for_uri (uri));
+            var protocol = this.get_protocol_for_uri (uri);
+
+            if (allow_internal || protocol != "internal") {
+                this.add_resource (didl_item, uri, protocol);
+            }
         }
     }
 



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