From 70904d8e2064126b38c0f157728881850e279b34 Mon Sep 17 00:00:00 2001 From: Alan Conway Date: Tue, 12 Jun 2012 17:30:10 +0000 Subject: NO-JIRA: Fix parsing of C++ URLs in qpid.messaging.util to handle IPv6 addresses. git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1349451 13f79535-47bb-0310-9956-ffa450edef68 --- qpid/python/qpid/messaging/util.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'qpid/python') diff --git a/qpid/python/qpid/messaging/util.py b/qpid/python/qpid/messaging/util.py index 265cf7d51f..726cfd5172 100644 --- a/qpid/python/qpid/messaging/util.py +++ b/qpid/python/qpid/messaging/util.py @@ -50,10 +50,13 @@ def set_reconnect_urls(conn, msg): reconnect_urls = [] urls = msg.properties["amq.failover"] for u in urls: + # FIXME aconway 2012-06-12: Nasty hack parsing of the C++ broker's URL format. if u.startswith("amqp:"): - for p in u[5:].split(","): - parts = p.split(":") - host, port = parts[1:3] + for a in u[5:].split(","): + parts = a.split(":") + # Handle IPv6 addresses which have : in the host part. + port = parts[-1] # Last : separated field is port + host = ":".join(parts[1:-1]) # First : separated field is protocol, host is the rest. reconnect_urls.append("%s:%s" % (host, port)) conn.reconnect_urls = reconnect_urls log.warn("set reconnect_urls for conn %s: %s", conn, reconnect_urls) -- cgit v1.2.1