[rygel/wip/meson-new-upnp: 4/5] server: Generate proper URIs for IPv6
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [rygel/wip/meson-new-upnp: 4/5] server: Generate proper URIs for IPv6
- Date: Wed, 28 Nov 2018 19:47:52 +0000 (UTC)
commit 74362840c43c9b1817a48f8e08ad959a95d6f15a
Author: Jens Georg <mail jensge org>
Date: Tue Nov 20 22:08:38 2018 +0100
server: Generate proper URIs for IPv6
src/librygel-server/rygel-http-item-uri.vala | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
---
diff --git a/src/librygel-server/rygel-http-item-uri.vala b/src/librygel-server/rygel-http-item-uri.vala
index b0e24174..d74e8d25 100644
--- a/src/librygel-server/rygel-http-item-uri.vala
+++ b/src/librygel-server/rygel-http-item-uri.vala
@@ -216,10 +216,18 @@ public class Rygel.HTTPItemURI : Object {
}
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);
+ var addr = this.http_server.context.get_address ();
+ if (addr.family == SocketFamily.IPV6) {
+ return "http://[%s]:%u%s%s".printf (addr.to_string (),
+ this.http_server.context.port,
+ this.http_server.path_root,
+ path);
+ } else {
+ return "http://%s:%u%s%s".printf (addr.to_string (),
+ this.http_server.context.port,
+ this.http_server.path_root,
+ path);
+ }
}
private string ext_from_mime_type (string mime_type) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]