I need a basic HTTPS server, without any web applications support,
so I've decided to use the listenTCP and listenSSL methods, together
with a twisted.web.http.HTTPFactory, a twisted.web.http.HTTPChannel protocol
and a twisted.web.http.Request handler.

I added a ServerContextFactory for SSL (like in echoserv_ssl.py example):

class ServerContextFactory:

   def getContext(self):
       """Create an SSL context.

       Similar to twisted's echoserv_ssl example, except the private key
       and certificate are in separate files."""
       print "Creating SSL context..."
       ctx = SSL.Context(SSL.SSLv23_METHOD)
       ctx.use_privatekey_file('serverkey.pem')
       ctx.use_certificate_file('servercert.pem')
       return ctx

if __name__ == "__main__":
   from twisted.internet import reactor
   reactor.listenTCP(8000, MyHttpFactory())
   reactor.listenSSL(8043, MyHttpFactory(), ServerContextFactory())
   reactor.run()

I'm testing this configuration with ApacheBench (ab), and I get some 800
requests/sec for HTTP, and only about 30 requests/sec for HTTPS. I now that
the ratio for HTTPS is about 60% of HTTP, so I was wondering if I'm
doing something wrong, or what is causing this problem.

Thank you.

_______________________________________________
Twisted-web mailing list
[email protected]
http://twistedmatrix.com/cgi-bin/mailman/listinfo/twisted-web

Reply via email to