简体   繁体   English

飓风(python)是否支持HTTPS连接和SSL?

[英]Does cyclone (python) support HTTPS connections and SSL?

Does cyclone (python) support HTTPS connections and SSL? 飓风(python)是否支持HTTPS连接和SSL? If so, can you please provide an example? 如果是这样,请您举个例子吗?

I've looked through the documentation and code on the cyclone github page , and can't find any reference to SSL. 我已经浏览了飓风github页面上的文档和代码,但是找不到对SSL的任何引用。 But since lots of cyclone is just wrapping twisted, maybe there's something I'm missing... 但是由于许多旋风只是缠绕缠绕,所以也许我缺少一些东西...

SSL examples have been added after I found this post. 找到这篇文章后,添加了SSL示例。 It's here: https://github.com/fiorix/cyclone/tree/master/demos/ssl 在这里: https : //github.com/fiorix/cyclone/tree/master/demos/ssl

From the README : 自述文件

cyclone is a Twisted protocol, therefore it may be used in conjunction with any other protocol implemented in Twisted. 旋风除尘器是Twisted协议,因此可以与Twisted中实现的任何其他协议结合使用。

If Twisted supports SSL then cyclone supports it eg: 如果Twisted支持SSL,则飓风支持SSL,例如:

#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)

Run it as: 运行为:

$ twistd -ny cyclone-ssl.py

The part that activates ssl is portstr . 激活ssl的部分是portstr It specifies that the server serves on 4443 port and uses server_key.pem as its private key, server_cert.pem as a certificate. 它指定服务器在4443端口上服务,并使用server_key.pem作为其私钥,使用server_cert.pem作为证书。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM