开发者

Basic SSL Server Using Twisted Not Responding

开发者 https://www.devze.com 2023-01-07 15:32 出处:网络
I am currently trying to pull together a basic SSL server in twisted. I pulled the following example right off their website:

I am currently trying to pull together a basic SSL server in twisted. I pulled the following example right off their website:

from twisted.internet import ssl, reactor
from twisted.internet.protocol import Factory, Protocol

class Echo(Protocol):
    def dataReceived(self, data):
        """As soon as any data is received, write it back."""
        print "dataReceived: %s" % data
        self.transport.write(data)

if __name__ == '__main__':
    factory = Factory()
    factory.protocol = Echo
    print "running reactor"
    reactor.listenSSL(8080, factory,
                      ssl.DefaultOpenSSLContextFactory(
            "./test/privatekey.pem", "./test/cacert.pem"))
    reactor.run()

I then tried to hit this server using firefox by setting the url to https://localhost:8080 yet I receive no response. I do, however, see the data arriving at the server. Any i开发者_如何转开发deas why I'm not getting a response?


You're not sending an http header back to the browser, and you're not closing the connection


You've implemented an SSL echo server here, not an HTTPS server. Use the openssl s_client command to test it interactively, not firefox (or any other HTTP client, for that matter).

0

精彩评论

暂无评论...
验证码 换一张
取 消