summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Dent <chris.dent@gmail.com>2019-01-07 11:12:42 +0000
committerChris Dent <chris.dent@gmail.com>2019-01-07 11:12:42 +0000
commitd12aa258e7b2a1a53046f9a84224cc94da2a8502 (patch)
tree73f3bd7cb528080301c8135997fbb0e885f580f1
parent5015532233dc25bf1594f79c0af7daf8d59a5f80 (diff)
downloadpaste-git-d12aa258e7b2a1a53046f9a84224cc94da2a8502.tar.gz
Revert "Remove use of OpenSSL.tsafe, which links to OpenSSL.SSL anyways. (#16)"
This reverts commit 78dd2ec0138467305f1686558fca4ff8ca0b2b70. That removes the use of the so-called "thread safe" tsafe module, which adds a lock around many messages, but did not account for the use of that lock in the paste/httpserver.py module. An attempt was made to just get rid of that lock, but since there is limited testing of that area, and few resources to confirm the change, it's been decided that keeping tsafe and allow the deprecation warning to be exposed is the best thing to do. With luck the decpration warning will encourage people to not use the httpserver and choose something else instead. Fixes #19
-rwxr-xr-xpaste/httpserver.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/paste/httpserver.py b/paste/httpserver.py
index 803fbe1..963285e 100755
--- a/paste/httpserver.py
+++ b/paste/httpserver.py
@@ -331,7 +331,7 @@ class WSGIHandlerMixin:
# http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/442473
#
try:
- from OpenSSL import SSL
+ from OpenSSL import SSL, tsafe
SocketErrors = (socket.error, SSL.ZeroReturnError, SSL.SysCallError)
except ImportError:
# Do not require pyOpenSSL to be installed, but disable SSL
@@ -379,7 +379,7 @@ else:
self.socket_type)
self.ssl_context = ssl_context
if ssl_context:
- class SSLConnection(SSL.Connection):
+ class TSafeConnection(tsafe.Connection):
def settimeout(self, *args):
self._lock.acquire()
try:
@@ -392,7 +392,7 @@ else:
return self._ssl_conn.gettimeout()
finally:
self._lock.release()
- self.socket = SSLConnection(ssl_context, self.socket)
+ self.socket = TSafeConnection(ssl_context, self.socket)
self.server_bind()
if request_queue_size:
self.socket.listen(request_queue_size)