qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From acon...@apache.org
Subject svn commit: r1349451 - /qpid/trunk/qpid/python/qpid/messaging/util.py
Date Tue, 12 Jun 2012 17:30:10 GMT
Author: aconway
Date: Tue Jun 12 17:30:10 2012
New Revision: 1349451

URL: http://svn.apache.org/viewvc?rev=1349451&view=rev
Log:
NO-JIRA: Fix parsing of C++ URLs in qpid.messaging.util to handle IPv6 addresses.

Modified:
    qpid/trunk/qpid/python/qpid/messaging/util.py

Modified: qpid/trunk/qpid/python/qpid/messaging/util.py
URL: http://svn.apache.org/viewvc/qpid/trunk/qpid/python/qpid/messaging/util.py?rev=1349451&r1=1349450&r2=1349451&view=diff
==============================================================================
--- qpid/trunk/qpid/python/qpid/messaging/util.py (original)
+++ qpid/trunk/qpid/python/qpid/messaging/util.py Tue Jun 12 17:30:10 2012
@@ -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)



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@qpid.apache.org
For additional commands, e-mail: commits-help@qpid.apache.org


Mime
View raw message