I am attempting to run a tornado https server with self signed certificates (with localhost as the domain name) I generated using openssl. I verified these with openssl. My python version is 2.7.8 (october build), my tornado version is 4.1.0. Here is my code for webserver, the handler implements a simple get request.
def main():
options.parse_command_line()
settings = {
'cookie_secret': '****',
'upload_path': UPLOAD_PATH,
'cookie_morsels': {
'httponly': True,
'max-age': 24 * 3600 # 1 day
},
}
ssl_options = {}
ssl_options['certfile'] = '/etc/ssl/my_cert.crt'
ssl_options['keyfile'] = '/etc/ssl/my_cert.key'
app = web.Application([
(r"/get", handlers.GetHandler)],
**settings)
http_server = httpserver.HTTPServer(app, ssl_options=ssl_options, max_buffer_size=4 * 1024 ** 3)
http_server.listen(options.port)
ioloop.IOLoop.instance().start()
The traceback I am getting is the following:
Traceback (most recent call last):
File "/home/.../local/lib/python2.7/site-packages/tornado/ioloop.py", line 840, in start
handler_func(fd_obj, events)
File "/home/.../local/lib/python2.7/site-packages/tornado/stack_context.py", line 275, in null_wrapper
return fn(*args, **kwargs)
File "/home/.../local/lib/python2.7/site-packages/tornado/netutil.py", line 223, in accept_handler
callback(connection, address)
File "/home/.../local/lib/python2.7/site-packages/tornado/tcpserver.py", line 225, in _handle_connection
do_handshake_on_connect=False)
File "/home/.../local/lib/python2.7/site-packages/tornado/netutil.py", line 468, in ssl_wrap_socket
return context.wrap_socket(socket, **kwargs)
File "/usr/lib/python2.7/ssl.py", line 350, in wrap_socket
_context=self)
TypeError: __init__() got an unexpected keyword argument 'server_hostname'
I read
here that this error is due to an ssl depreciation in python2.7, but this can't be the only way to implement ssl in tornado python2.7?
Thanks in advance for any advice.