Python2.4/2.5 SSL support
This commit is contained in:
parent
2d5a9ef364
commit
9af203652b
19
speedtest.py
19
speedtest.py
|
@ -97,6 +97,11 @@ except ImportError:
|
||||||
except ImportError:
|
except ImportError:
|
||||||
HTTPSConnection = None
|
HTTPSConnection = None
|
||||||
|
|
||||||
|
try:
|
||||||
|
from httplib import FakeSocket
|
||||||
|
except ImportError:
|
||||||
|
FakeSocket = None
|
||||||
|
|
||||||
try:
|
try:
|
||||||
from Queue import Queue
|
from Queue import Queue
|
||||||
except ImportError:
|
except ImportError:
|
||||||
|
@ -447,6 +452,20 @@ if HTTPSConnection:
|
||||||
self.sock.server_hostname = self.host
|
self.sock.server_hostname = self.host
|
||||||
except AttributeError:
|
except AttributeError:
|
||||||
pass
|
pass
|
||||||
|
elif FakeSocket:
|
||||||
|
# Python 2.4/2.5 support
|
||||||
|
try:
|
||||||
|
self.sock = FakeSocket(self.sock, socket.ssl(self.sock))
|
||||||
|
except AttributeError:
|
||||||
|
raise SpeedtestException(
|
||||||
|
'This version of Python does not support HTTPS/SSL '
|
||||||
|
'functionality'
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
raise SpeedtestException(
|
||||||
|
'This version of Python does not support HTTPS/SSL '
|
||||||
|
'functionality'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def _build_connection(connection, source_address, timeout, context=None):
|
def _build_connection(connection, source_address, timeout, context=None):
|
||||||
|
|
Loading…
Reference in New Issue