cyclone (python)是否支持HTTPS连接和SSL?如果有,你能举个例子吗?
我浏览了cyclone github page上的文档和代码,但找不到任何关于SSL的参考。但由于许多旋风只是缠绕在一起,也许我遗漏了一些东西。
发布于 2012-03-17 17:08:46
cyclone是一种Twisted协议,因此它可以与Twisted中实现的任何其他协议一起使用。
如果Twisted支持SSL,那么cyclone也支持它,例如:
#file: cyclone-ssl.py
import cyclone.web
class IndexHandler(cyclone.web.RequestHandler):
def get(self):
self.write("hello world")
factory = cyclone.web.Application([(r"/", IndexHandler)])
portstr = "ssl:4443:privateKey=server_key.pem:certKey=server_cert.pem"
# make twisted app
from twisted.application import service, strports
application = service.Application("cyclone-ssl")
strports.service(portstr, factory).setServiceParent(application)以如下方式运行:
$ twistd -ny cyclone-ssl.py激活ssl的部分是portstr。它指定服务器在4443端口上服务,并使用server_key.pem作为其私钥,使用server_cert.pem作为证书。
发布于 2012-06-11 14:51:34
在我找到这篇文章后,我添加了SSL示例。在这里:https://github.com/fiorix/cyclone/tree/master/demos/ssl
https://stackoverflow.com/questions/9746709
复制相似问题