summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
authorJan Cholasta <jcholast@redhat.com>2011-09-30 10:09:55 +0200
committerMartin Kosek <mkosek@redhat.com>2011-10-05 10:58:25 +0200
commit12bfed37d4d22319e2cfadb5d9b460da7e748432 (patch)
tree58deb5415d489ac25bad5df267a2df523ba142cc /ipalib
parenta16b5b4c00ca9b82cd40a2c2be22c9e77e0ce64a (diff)
downloadfreeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.tar.gz
freeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.tar.xz
freeipa-12bfed37d4d22319e2cfadb5d9b460da7e748432.zip
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
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/rpc.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/ipalib/rpc.py b/ipalib/rpc.py
index 5491b28da..f8e4d9e6a 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.