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):
socket_bind_and_listen(sock, address, backlog=backlog)
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
can do SSL.
......@@ -652,7 +652,7 @@ def ssl_listener(address, certificate, private_key):
which accepts connections forever and spawns greenlets for
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)
sock.is_secure = True
return sock
......
......@@ -74,9 +74,7 @@ class TestApi(TestCase):
finally:
listenfd.close()
server = socket.ssl_listener(('0.0.0.0', 0),
self.certificate_file,
self.private_key_file)
server = socket.ssl_listener(('0.0.0.0', 0), self.private_key_file, self.certificate_file)
gevent.spawn(accept_once, server)
client = socket.wrap_ssl(
......
......@@ -334,7 +334,7 @@ class TestHttps(TestCase):
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')
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)
try:
......@@ -352,7 +352,7 @@ class TestHttps(TestCase):
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')
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)
try:
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