root/trunk/doc/core/examples/echoserv_ssl.py

Revision 30752, 0.8 KB (checked in by exarkun, 15 months ago)

Rewrite the copyright headers to exclude date information.

Author: exarkun
Reviewer: glyph
Fixes: #4857

To avoid the need to perpetually update copyright dates in each file in Twisted,
remove the dates from most files and just leave them in the LICENSE file.

As a side effect, some files also have had a trailing newline added where it was
missing before.

Line 
1
2# Copyright (c) Twisted Matrix Laboratories.
3# See LICENSE for details.
4
5
6from OpenSSL import SSL
7
8class ServerContextFactory:
9   
10    def getContext(self):
11        """Create an SSL context.
12       
13        This is a sample implementation that loads a certificate from a file
14        called 'server.pem'."""
15        ctx = SSL.Context(SSL.SSLv23_METHOD)
16        ctx.use_certificate_file('server.pem')
17        ctx.use_privatekey_file('server.pem')
18        return ctx
19
20
21if __name__ == '__main__':
22    import echoserv, sys
23    from twisted.internet.protocol import Factory
24    from twisted.internet import ssl, reactor
25    from twisted.python import log
26    log.startLogging(sys.stdout)
27    factory = Factory()
28    factory.protocol = echoserv.Echo
29    reactor.listenSSL(8000, factory, ServerContextFactory())
30    reactor.run()
Note: See TracBrowser for help on using the browser.