diff options
author | Tomás Touceda <chiiph@leap.se> | 2014-03-05 13:53:04 -0300 |
---|---|---|
committer | Tomás Touceda <chiiph@leap.se> | 2014-03-05 13:53:04 -0300 |
commit | 96f0ec9b4be1a1b26d7fd7f8906219660e209fe6 (patch) | |
tree | c67f691792320de22c5c29178b1703f67bfb248a | |
parent | 0a3905d9d643117483681bcc1cda2258702dc94d (diff) | |
parent | dcff2ecd5ca63b09f5e40cca4e18c4660406d5d6 (diff) |
Merge remote-tracking branch 'refs/remotes/kali/bug/soledad-client-socket-2.6' into develop
-rw-r--r-- | client/changes/bug_5208_support_socket_26 | 1 | ||||
-rw-r--r-- | client/src/leap/soledad/client/__init__.py | 14 |
2 files changed, 12 insertions, 3 deletions
diff --git a/client/changes/bug_5208_support_socket_26 b/client/changes/bug_5208_support_socket_26 new file mode 100644 index 00000000..b44d1d4e --- /dev/null +++ b/client/changes/bug_5208_support_socket_26 @@ -0,0 +1 @@ + o Back-compatibility for socket.create_connection interface in 2.6. Closes: #5208 diff --git a/client/src/leap/soledad/client/__init__.py b/client/src/leap/soledad/client/__init__.py index f0abf130..b5ce7c32 100644 --- a/client/src/leap/soledad/client/__init__.py +++ b/client/src/leap/soledad/client/__init__.py @@ -1311,9 +1311,17 @@ class VerifiedHTTPSConnection(httplib.HTTPSConnection): # derived from httplib.py def connect(self): - "Connect to a host on a given (SSL) port." - sock = socket.create_connection((self.host, self.port), - SOLEDAD_TIMEOUT, self.source_address) + """ + Connect to a host on a given (SSL) port. + """ + try: + source = self.source_address + sock = socket.create_connection((self.host, self.port), + SOLEDAD_TIMEOUT, source) + except AttributeError: + # source_address was introduced in 2.7 + sock = socket.create_connection((self.host, self.port), + SOLEDAD_TIMEOUT) if self._tunnel_host: self.sock = sock self._tunnel() |