Commit cd86f529 authored by Denis Bilenko's avatar Denis Bilenko

server: remove _allowed_ssl_args, allow any arguments to be passed (including...

server: remove _allowed_ssl_args, allow any arguments to be passed (including 'ciphers' which was not included into _allowed_ssl_args)
parent 45be8a5a
...@@ -24,6 +24,8 @@ class StreamServer(BaseServer): ...@@ -24,6 +24,8 @@ class StreamServer(BaseServer):
- ssl_version - ssl_version
- ca_certs - ca_certs
- suppress_ragged_eofs - suppress_ragged_eofs
- do_handshake_on_connect
- ciphers
Note that although the errors in a successfully spawned handler will not affect the server or other connections, Note that although the errors in a successfully spawned handler will not affect the server or other connections,
the errors raised by :func:`accept` and *spawn* cause the server to stop accepting for a short amount of time. The the errors raised by :func:`accept` and *spawn* cause the server to stop accepting for a short amount of time. The
...@@ -39,13 +41,9 @@ class StreamServer(BaseServer): ...@@ -39,13 +41,9 @@ class StreamServer(BaseServer):
min_delay = 0.01 min_delay = 0.01
max_delay = 1 max_delay = 1
_allowed_ssl_args = ('keyfile', 'certfile', 'cert_reqs', 'ssl_version', 'ca_certs', 'suppress_ragged_eofs')
def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args): def __init__(self, listener, handle=None, backlog=None, spawn='default', **ssl_args):
if ssl_args: if ssl_args:
for arg in ssl_args: ssl_args.setdefault('server_side', True)
if arg not in self._allowed_ssl_args:
raise TypeError('StreamServer.__init__() got an unexpected keyword argument %r' % arg)
try: try:
from gevent.ssl import wrap_socket from gevent.ssl import wrap_socket
except ImportError: except ImportError:
...@@ -152,7 +150,7 @@ class StreamServer(BaseServer): ...@@ -152,7 +150,7 @@ class StreamServer(BaseServer):
def wrap_socket_and_handle(self, client_socket, address): def wrap_socket_and_handle(self, client_socket, address):
# used in case of ssl sockets # used in case of ssl sockets
ssl_socket = self.wrap_socket(client_socket, server_side=True, **self.ssl_args) ssl_socket = self.wrap_socket(client_socket, **self.ssl_args)
return self.handle(ssl_socket, address) return self.handle(ssl_socket, address)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment