[Twisted-web] Twisted Web with SSL?

James Y Knight foom at fuhm.net
Fri Feb 4 12:58:47 MST 2005


On Feb 4, 2005, at 12:56 PM, Jeff Bauer wrote:
> I've looked for information about implmenting a Twisted
> web server with SSL, but came up short.  A quick scan
> of mail on this list for the past year doesn't have
> any discussion about SSL, or I may have just overlooked
> it.

There's probably no discussion, because it just works.

# Standard startup procedure for HTTP port (you need to have setup site 
above, of course)
application = service.Application("web")
i = internet.TCPServer(8080, site)
i.setServiceParent(service.IServiceCollection(application))

# Add two more lines to start a HTTPs port. (you'll need to have made 
your ssl key/crt beforehand)
i = internet.SSLServer(8081, site, 
ssl.DefaultOpenSSLContextFactory("ssl.key", "ssl.crt"))
i.setServiceParent(service.IServiceCollection(application))

James




More information about the Twisted-web mailing list