OLD | NEW |
1 """TLS Lite + SocketServer.""" | 1 """TLS Lite + SocketServer.""" |
2 | 2 |
3 from tlslite.TLSConnection import TLSConnection | 3 from tlslite.tlsconnection import TLSConnection |
4 | 4 |
5 class TLSSocketServerMixIn: | 5 class TLSSocketServerMixIn: |
6 """ | 6 """ |
7 This class can be mixed in with any L{SocketServer.TCPServer} to | 7 This class can be mixed in with any L{SocketServer.TCPServer} to |
8 add TLS support. | 8 add TLS support. |
9 | 9 |
10 To use this class, define a new class that inherits from it and | 10 To use this class, define a new class that inherits from it and |
11 some L{SocketServer.TCPServer} (with the mix-in first). Then | 11 some L{SocketServer.TCPServer} (with the mix-in first). Then |
12 implement the handshake() method, doing some sort of server | 12 implement the handshake() method, doing some sort of server |
13 handshake on the connection argument. If the handshake method | 13 handshake on the connection argument. If the handshake method |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 | 49 |
50 def finish_request(self, sock, client_address): | 50 def finish_request(self, sock, client_address): |
51 tlsConnection = TLSConnection(sock) | 51 tlsConnection = TLSConnection(sock) |
52 if self.handshake(tlsConnection) == True: | 52 if self.handshake(tlsConnection) == True: |
53 self.RequestHandlerClass(tlsConnection, client_address, self) | 53 self.RequestHandlerClass(tlsConnection, client_address, self) |
54 tlsConnection.close() | 54 tlsConnection.close() |
55 | 55 |
56 #Implement this method to do some form of handshaking. Return True | 56 #Implement this method to do some form of handshaking. Return True |
57 #if the handshake finishes properly and the request is authorized. | 57 #if the handshake finishes properly and the request is authorized. |
58 def handshake(self, tlsConnection): | 58 def handshake(self, tlsConnection): |
59 raise NotImplementedError() | 59 raise NotImplementedError() |
OLD | NEW |