/offlineimap/head: changeset 457

Made OfflineIMAP IPv6-aware. Used the short patch from Adriaan Peeters
<apeeters@lashout.net> in Debian bug report 186636. Closes: #186636.
This commit is contained in:
jgoerzen
2003-04-29 03:17:30 +01:00
parent 044877a5f5
commit 56ac894f41
2 changed files with 13 additions and 2 deletions

View File

@@ -217,8 +217,16 @@ class IMAP4:
"""
self.host = host
self.port = port
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
self.sock.connect((host, port))
#This connects to the first ip found ipv4/ipv6
#Added by Adriaan Peeters <apeeters@lashout.net> based on a socket
#example from the python documentation:
#http://www.python.org/doc/lib/socket-example.html
res = socket.getaddrinfo(host, port, socket.AF_UNSPEC,
socket.SOCK_STREAM)
af, socktype, proto, canonname, sa = res[0]
self.sock = socket.socket(af, socktype, proto)
self.sock.connect(sa)
self.file = self.sock.makefile('rb')