Commit b13b5819 authored by Denis Bilenko's avatar Denis Bilenko

socket: change order of arguments to ssl_listener to be in line with...

socket: change order of arguments to ssl_listener to be in line with wrap_ssl() function; fix the tests
parent adaecf56
...@@ -638,7 +638,7 @@ def tcp_listener(address, backlog=50): ...@@ -638,7 +638,7 @@ def tcp_listener(address, backlog=50):
socket_bind_and_listen(sock, address, backlog=backlog) socket_bind_and_listen(sock, address, backlog=backlog)
return sock return sock
def ssl_listener(address, certificate, private_key): def ssl_listener(address, private_key, certificate):
"""Listen on the given (ip, port) *address* with a TCP socket that """Listen on the given (ip, port) *address* with a TCP socket that
can do SSL. can do SSL.
...@@ -652,7 +652,7 @@ def ssl_listener(address, certificate, private_key): ...@@ -652,7 +652,7 @@ def ssl_listener(address, certificate, private_key):
which accepts connections forever and spawns greenlets for which accepts connections forever and spawns greenlets for
each incoming connection. each incoming connection.
""" """
sock = wrap_ssl(_original_socket(), certificate, private_key) sock = wrap_ssl(_original_socket(), private_key, certificate)
socket_bind_and_listen(sock, address) socket_bind_and_listen(sock, address)
sock.is_secure = True sock.is_secure = True
return sock return sock
......
...@@ -74,9 +74,7 @@ class TestApi(TestCase): ...@@ -74,9 +74,7 @@ class TestApi(TestCase):
finally: finally:
listenfd.close() listenfd.close()
server = socket.ssl_listener(('0.0.0.0', 0), server = socket.ssl_listener(('0.0.0.0', 0), self.private_key_file, self.certificate_file)
self.certificate_file,
self.private_key_file)
gevent.spawn(accept_once, server) gevent.spawn(accept_once, server)
client = socket.wrap_ssl( client = socket.wrap_ssl(
......
...@@ -334,7 +334,7 @@ class TestHttps(TestCase): ...@@ -334,7 +334,7 @@ class TestHttps(TestCase):
certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt') certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key') private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')
sock = socket.ssl_listener(('', 4201), certificate_file, private_key_file) sock = socket.ssl_listener(('', 4201), private_key_file, certificate_file)
g = gevent.spawn(wsgi.server, sock, wsgi_app) g = gevent.spawn(wsgi.server, sock, wsgi_app)
try: try:
...@@ -352,7 +352,7 @@ class TestHttps(TestCase): ...@@ -352,7 +352,7 @@ class TestHttps(TestCase):
certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt') certificate_file = os.path.join(os.path.dirname(__file__), 'test_server.crt')
private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key') private_key_file = os.path.join(os.path.dirname(__file__), 'test_server.key')
sock = socket.ssl_listener(('', 4202), certificate_file, private_key_file) sock = socket.ssl_listener(('', 4202), private_key_file, certificate_file)
g = gevent.spawn(wsgi.server, sock, wsgi_app) g = gevent.spawn(wsgi.server, sock, wsgi_app)
try: try:
req = HTTPRequest("https://localhost:4202/foo") req = HTTPRequest("https://localhost:4202/foo")
......
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