From 12bfed37d4d22319e2cfadb5d9b460da7e748432 Mon Sep 17 00:00:00 2001 From: Jan Cholasta Date: Fri, 30 Sep 2011 10:09:55 +0200 Subject: Add a function for formatting network locations of the form host:port for use in URLs. If the host part is a literal IPv6 address, it must be enclosed in square brackets (RFC 2732). ticket 1869 --- ipalib/rpc.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'ipalib/rpc.py') diff --git a/ipalib/rpc.py b/ipalib/rpc.py index 5491b28d..f8e4d9e6 100644 --- a/ipalib/rpc.py +++ b/ipalib/rpc.py @@ -306,7 +306,7 @@ class xmlclient(Connectible): scheme = "https" else: scheme = "http" - server = '%s://%s%s' % (scheme, self.conn._ServerProxy__host, self.conn._ServerProxy__handler) + server = '%s://%s%s' % (scheme, ipautil.format_netloc(self.conn._ServerProxy__host), self.conn._ServerProxy__handler) return server def get_url_list(self): @@ -321,7 +321,7 @@ class xmlclient(Connectible): for r in rs: if r.dns_type == dnsclient.DNS_T_SRV: rsrv = r.rdata.server.rstrip('.') - servers.append('https://%s%s' % (rsrv, path)) + servers.append('https://%s%s' % (ipautil.format_netloc(rsrv), path)) servers = list(set(servers)) # the list/set conversion won't preserve order so stick in the # local config file version here. -- cgit