diff options
| author | Alan Conway <aconway@apache.org> | 2012-06-12 17:30:10 +0000 |
|---|---|---|
| committer | Alan Conway <aconway@apache.org> | 2012-06-12 17:30:10 +0000 |
| commit | 70904d8e2064126b38c0f157728881850e279b34 (patch) | |
| tree | c1fb5b9154c688e9550e549ab615d12ec7061ea3 /qpid/python | |
| parent | b69978463135937995fbcd15a0f7b30aa63044e5 (diff) | |
| download | qpid-python-70904d8e2064126b38c0f157728881850e279b34.tar.gz | |
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
Diffstat (limited to 'qpid/python')
| -rw-r--r-- | qpid/python/qpid/messaging/util.py | 9 |
1 files changed, 6 insertions, 3 deletions
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) |
