parent
b479d74db8
commit
cf4a3b1861
@ -1127,8 +1127,15 @@ class IMAP4_SSL(IMAP4):
|
|||||||
"""
|
"""
|
||||||
self.host = host
|
self.host = host
|
||||||
self.port = port
|
self.port = port
|
||||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
#This connects to the first ip found ipv4/ipv6
|
||||||
self.sock.connect((host, port))
|
#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)
|
||||||
if sys.version_info[0] <= 2 and sys.version_info[1] <= 2:
|
if sys.version_info[0] <= 2 and sys.version_info[1] <= 2:
|
||||||
self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile)
|
self.sslobj = socket.ssl(self.sock, self.keyfile, self.certfile)
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user