Fix for host with IPv6 enable but without default IPv6 route
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
* Fix for host with IPv6 enable but without default IPv6 route
|
||||
* Allow egg installation
|
||||
|
||||
Version 1.0.0 - 2008-11-17
|
||||
|
||||
+11
-6
@@ -10,6 +10,7 @@ except ImportError:
|
||||
DNS_CACHE = {}
|
||||
MAX_SIZE = 999999999
|
||||
MAX_LENGHT = len(str(MAX_SIZE))
|
||||
TIMEOUT = 120
|
||||
|
||||
_ALLOWED_MODULES = {'datetime': ['datetime', 'date'], 'decimal': ['Decimal']}
|
||||
|
||||
@@ -44,12 +45,14 @@ class PySocket:
|
||||
socket.getaddrinfo(host, int(port), socket.AF_INET6)
|
||||
self.sock = socket.socket(socket.AF_INET6,
|
||||
socket.SOCK_STREAM)
|
||||
self.sock.settimeout(TIMEOUT)
|
||||
self.sock.connect((host, int(port)))
|
||||
except:
|
||||
pass
|
||||
self.sock = None
|
||||
if self.sock is None:
|
||||
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
self.sock.settimeout(120)
|
||||
self.sock.connect((host, int(port)))
|
||||
self.sock.settimeout(TIMEOUT)
|
||||
self.sock.connect((host, int(port)))
|
||||
DNS_CACHE[hostname], port = self.sock.getpeername()[:2]
|
||||
try:
|
||||
sock = None
|
||||
@@ -57,12 +60,14 @@ class PySocket:
|
||||
try:
|
||||
socket.getaddrinfo(host, int(port), socket.AF_INET6)
|
||||
sock = socket.socket(socket.AF_INET6, socket.SOCK_STREAM)
|
||||
sock.settimeout(TIMEOUT)
|
||||
sock.connect((host, int(port)))
|
||||
except:
|
||||
pass
|
||||
sock = None
|
||||
if sock is None:
|
||||
sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
sock.settimeout(120)
|
||||
sock.connect((host, int(port)))
|
||||
sock.settimeout(TIMEOUT)
|
||||
sock.connect((host, int(port)))
|
||||
if hasattr(socket, 'ssl'):
|
||||
ssl_sock = socket.ssl(sock)
|
||||
self.ssl = True
|
||||
|
||||
Reference in New Issue
Block a user