[Twisted-web] reactor.listenSSL() question
exarkun at divmod.com
Tue Apr 21 14:13:00 EDT 2009
On Tue, 21 Apr 2009 13:47:06 -0400, vitaly at synapticvision.com wrote:
>I'm trying to make work the following client/server, but the
>server always return: HTTP/1.1 400 Bad Request.
You seem to be connecting something which is not an HTTP client to an
HTTP server. So the HTTP server complains because what is being sent
to it is not an HTTP request.
> [snip - setup]
> reactor.listenSSL(8050, server.Site(root), ServerContextFactory())
There's your HTTP server.
> [snip - imports]
> def connectionMade(self):
> self.sendLine("Hello, world!")
> self.sendLine("What a fine day it is.")
> [snip - more stuff]
> factory = EchoClientFactory()
> reactor.connectSSL('localhost', 8050, factory,
And there's your client - something which isn't going to send HTTP
requests to the server it connects to.
So a 400 response is precisely what you should expect here. :)
More information about the Twisted-web