ebin123456 / py-amqplib

Automatically exported from code.google.com/p/py-amqplib
GNU Lesser General Public License v2.1
0 stars 0 forks source link

transport.py assumes IPv4 #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm not going to use the template, because it seems to be almost entirely 
inapplicable.

We want to connect to our RabbitMQ server with Carrot using IPv6. 
Unfortunately, transport.py hardcodes AF_INET, which means it will always use 
IPv4.

I'm fairly new to Python, but there must be some frontend to getaddrinfo(), 
which allows you to connect in a protocol-neutral way, right?

Original issue reported on code.google.com by edschou...@gmail.com on 21 Jun 2011 at 2:43

GoogleCodeExporter commented 9 years ago
I agree, IPv6 should be supported.   

Haven't done much with IPv6 yet, but the Python socket library has a 
getaddrinfo() function, so I imagine this should be fairly easy.  I signed up 
for a tunnel to Hurricane Electric a couple weeks ago, so this is something I 
was going to be playing with.

Original comment by barry.pe...@gmail.com on 21 Jun 2011 at 8:47

GoogleCodeExporter commented 9 years ago
I've just changed the code to use getaddrinfo(). Please see the attached patch.

Because I wrote this patch during office hours, I'd better keep my employer 
happy by saying:

Sponsored by: Kumina bv -- http://kumina.nl/

Original comment by edschou...@gmail.com on 22 Jun 2011 at 7:27

Attachments:

GoogleCodeExporter commented 9 years ago
I worked on it last night too, came up with almost identical code in rev 
d38e3dcd4f4a  (I suppose we probably both looked at the same examples).  I 
added a bit extra though to support RFC 2732 style literal addresses with port 
numbers, such as [::1]:5672  

Unittested on Pythons 2.4 .. 3.2, let me know how it goes

Original comment by barry.pe...@gmail.com on 22 Jun 2011 at 3:23