[rygel] server: Move knowledge about remoteness
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel] server: Move knowledge about remoteness
- Date: Fri, 5 Dec 2014 20:24:45 +0000 (UTC)
commit 0576c1696bfe423b622e2b5799714c34ce5938b8
Author: Jens Georg <mail jensge org>
Date: Sat Nov 29 14:31:07 2014 +0100
server: Move knowledge about remoteness
Locality was deduced from the HTTP server's properties. This patch moves the
knowledge to the HTTP server.
Based on code from Cablelab's patches.
Signed-off-by: Jens Georg <mail jensge org>
src/librygel-server/rygel-http-server.vala | 11 +++++++++++
src/librygel-server/rygel-media-item.vala | 5 +----
2 files changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/librygel-server/rygel-http-server.vala b/src/librygel-server/rygel-http-server.vala
index 42a5116..6986eb2 100644
--- a/src/librygel-server/rygel-http-server.vala
+++ b/src/librygel-server/rygel-http-server.vala
@@ -1,10 +1,12 @@
/*
* Copyright (C) 2008, 2009 Nokia Corporation.
* Copyright (C) 2012 Intel Corporation.
+ * Copyright (C) 2013 Cable Television Laboratories, Inc.
*
* Author: Zeeshan Ali (Khattak) <zeeshanak gnome org>
* <zeeshan ali nokia com>
* Jens Georg <jensg openismus com>
+ * Craig Pratt <craig ecaspia com>
*
* This file is part of Rygel.
*
@@ -33,6 +35,7 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
public MediaContainer root_container;
public GUPnP.Context context;
private ArrayList<HTTPRequest> requests;
+ private bool locally_hosted;
public Cancellable cancellable { get; set; }
@@ -45,6 +48,10 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
this.requests = new ArrayList<HTTPRequest> ();
this.cancellable = content_dir.cancellable;
+ // FIXME: Needs adaptation for IPv6
+ this.locally_hosted = this.context.interface == "lo" ||
+ this.context.host_ip == "127.0.0.1";
+
this.path_root = "/" + name;
}
@@ -128,6 +135,10 @@ public class Rygel.HTTPServer : Rygel.TranscodeManager, Rygel.StateMachine {
return protocol_infos;
}
+ public bool is_local () {
+ return this.locally_hosted;
+ }
+
private void on_request_completed (StateMachine machine) {
var request = machine as HTTPRequest;
diff --git a/src/librygel-server/rygel-media-item.vala b/src/librygel-server/rygel-media-item.vala
index ad0f158..2782e8d 100644
--- a/src/librygel-server/rygel-media-item.vala
+++ b/src/librygel-server/rygel-media-item.vala
@@ -249,10 +249,7 @@ public abstract class Rygel.MediaItem : MediaObject {
var host_ip = http_server.context.host_ip;
// then original URIs
- bool internal_allowed;
- internal_allowed = http_server.context.interface == "lo" ||
- host_ip == "127.0.0.1";
- this.add_resources (didl_item, internal_allowed);
+ this.add_resources (didl_item, http_server.is_local ());
foreach (var res in didl_item.get_resources ()) {
res.uri = MediaItem.address_regex.replace_literal (res.uri,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]