tlslite.integration.xmlrpcserver

Package tlslite :: Package integration :: Module xmlrpcserver |
[hide private]
[frames] | no frames]

# Source Code for Module tlslite.integration.xmlrpcserver

     1  # Author: Kees Bos
     2  # See the LICENSE file for legal information regarding use of this file.
     3
     4  """xmlrpcserver.py - simple XML RPC server supporting TLS"""
     5
     6  from SimpleXMLRPCServer import SimpleXMLRPCServer, SimpleXMLRPCRequestHandler
     7  from tlssocketservermixin import TLSSocketServerMixIn
     8
     9
    10 -class TLSXMLRPCRequestHandler(SimpleXMLRPCRequestHandler):
    11      """XMLRPCRequestHandler using TLS"""
    12
    13      # Redefine the setup method (see SocketServer.StreamRequestHandler)
    14 -    def setup(self):
    15          self.connection = self.request
    16          if getattr(self, 'timeout', None) is not None:
    17              # Python 2.7
    18              self.connection.settimeout(self.timeout)
    19          self.rfile = self.connection.makefile('rb', self.rbufsize)
    20          self.wfile = self.connection.makefile('wb', self.wbufsize)
    21
    22 -    def do_POST(self):
    23          """Handles the HTTPS POST request."""
    24          SimpleXMLRPCRequestHandler.do_POST(self)
    25          try:
    26              # shut down the connection
    27              self.connection.shutdown()
    28          except:
    29              pass
    30
    31
    32 -class TLSXMLRPCServer(TLSSocketServerMixIn,
    33                        SimpleXMLRPCServer):
    34      """Simple XML-RPC server using TLS"""
    35
    36 -    def __init__(self, addr, *args, **kwargs):
    37          if not args and not 'requestHandler' in kwargs:
    38              kwargs['requestHandler'] = TLSXMLRPCRequestHandler
    39          SimpleXMLRPCServer.__init__(self, addr, *args, **kwargs)
    40
    41
    42 -class MultiPathTLSXMLRPCServer(TLSXMLRPCServer):
    43      """Multipath XML-RPC Server using TLS"""
    44
    45 -    def __init__(self, addr, *args, **kwargs):
    46          TLSXMLRPCServer.__init__(addr, *args, **kwargs)
    47          self.dispatchers = {}
    48          self.allow_none = allow_none
    49          self.encoding = encoding
    50