mirror of
https://github.com/Tautulli/Tautulli.git
synced 2025-07-11 07:46:07 -07:00
Fix OpenSSL SSL.ConnectionType deprecation warning
This patches the vendored cherrypy lib to work around a deprecation warning in pyOpenSSL 17.1.0 and later by checking and using the SSL.Connection class if available and falling back to ConnectionType.
This commit is contained in:
parent
a8c5f48b60
commit
f6162a8df8
1 changed files with 5 additions and 1 deletions
|
@ -39,6 +39,10 @@ from cherrypy import wsgiserver
|
|||
try:
|
||||
from OpenSSL import SSL
|
||||
from OpenSSL import crypto
|
||||
if hasattr(SSL, 'Connection'):
|
||||
SSLConnectionType = SSL.Connection
|
||||
else:
|
||||
SSLConnectionType = SSL.ConnectionType
|
||||
except ImportError:
|
||||
SSL = None
|
||||
|
||||
|
@ -244,7 +248,7 @@ class pyOpenSSLAdapter(wsgiserver.SSLAdapter):
|
|||
return ssl_environ
|
||||
|
||||
def makefile(self, sock, mode='r', bufsize=-1):
|
||||
if SSL and isinstance(sock, SSL.ConnectionType):
|
||||
if SSL and isinstance(sock, SSLConnectionType):
|
||||
timeout = sock.gettimeout()
|
||||
f = SSL_fileobject(sock, mode, bufsize)
|
||||
f.ssl_timeout = timeout
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue