summaryrefslogtreecommitdiff
path: root/src/leap/soledad/shared_db.py
diff options
context:
space:
mode:
authordrebs <drebs@leap.se>2013-05-13 18:12:53 -0300
committerdrebs <drebs@leap.se>2013-05-14 09:12:33 -0300
commit85fa4c91448e36658679cbac982ee00b18f95daa (patch)
tree78d04d36a2dcc5f78c92f39b5c9aa0ef219023bd /src/leap/soledad/shared_db.py
parentd97c607fa8e5e5659e2992b3c8a7c4ab14988fef (diff)
Refactor ssl monkey patching and fix https tests.
Diffstat (limited to 'src/leap/soledad/shared_db.py')
-rw-r--r--src/leap/soledad/shared_db.py29
1 files changed, 1 insertions, 28 deletions
diff --git a/src/leap/soledad/shared_db.py b/src/leap/soledad/shared_db.py
index 3929e828..c954dbea 100644
--- a/src/leap/soledad/shared_db.py
+++ b/src/leap/soledad/shared_db.py
@@ -26,38 +26,11 @@ except ImportError:
import json # noqa
-from u1db.remote import http_database, http_client
+from u1db.remote import http_database
from leap.soledad.auth import TokenBasedAuth
-SOLEDAD_CERT = None
-
-#-----------------------------------------------------------------------------
-# Monkey patching u1db to be able to provide a custom SSL cert
-#-----------------------------------------------------------------------------
-
-import httplib
-import socket
-import ssl
-
-class VerifiedHTTPSConnection(httplib.HTTPSConnection):
- """HTTPSConnection verifying server side certificates."""
- # derived from httplib.py
-
- def connect(self):
- "Connect to a host on a given (SSL) port."
- sock = socket.create_connection((self.host, self.port),
- self.timeout, self.source_address)
- if self._tunnel_host:
- self.sock = sock
- self._tunnel()
- self.sock = ssl.wrap_socket(sock, self.key_file, SOLEDAD_CERT,
- ssl_version=ssl.PROTOCOL_SSLv3,
- cert_reqs=ssl.CERT_REQUIRED,
- ca_certs=SOLEDAD_CERT)
-
-http_client._VerifiedHTTPSConnection = VerifiedHTTPSConnection
#-----------------------------------------------------------------------------
# Soledad shared database