Ejemplo n.º 1
0
def start_server(bind, port, dir):

    class N3Handler(BaseRequestHandler):

        def handle(self):
            self.data = self.request.recv(1024).strip()
            print("{} wrote:".format(self.client_address[0]))
            print(self.data)
            self.request.sendall(self.data.upper())

    server = SecureHTTPServer((bind, port), N3Handler, expanduser(dir))
    server.serve_forever()
Ejemplo n.º 2
0
 def test_server(self):
     cacert, cakey = create_self_signed_cacert()
     cert, key = create_session_cert(cacert, cakey)
     server = SecureHTTPServer(("localhost", 4443), key, cert, SecureHTTPRequestHandler)
     Thread(target=server.serve_forever()).run()