7 Oct
2014
7 Oct
'14
10:21 p.m.
Another problem is that Twisted doesn't yet support SSL on adopted sockets.
I did this by hand: # Suppose your create/bind/list your listen_socket, and # its file descriptor is listen_socket_fd site = server.Site(MyHttpsSite()) cert = '/path/to/my/cert' key = '/path/to/my/key' ctx = DefaultOpenSSLContextFactory(key, cert) tlsFactory = tls.TLSMemoryBIOFactory(ctx, False, site) p = tcp.Port._fromListeningDescriptor(reactor, listen_socket_fd, socket.AF_INET, tlsFactory) p._type = 'TLS' p.startListening() os.close(listen_socket_fd) reactor.run()