예제 #1
0
 def __init__(self,
              port,
              serve_from,
              max_active_conns=25,
              default_page='index.html'):
     """Constructs an HTTP server listening on the specified port and serving
     files from the specified folder 'serve_from'."""
     TCPServer.__init__(self, port, max_active_conns)
     self.serve_from = serve_from
     self.default_page = default_page
예제 #2
0
파일: HTTPServer.py 프로젝트: dound/vns
    def handle_tcp(self, pkt):
        # take care of the usual TCP stuff
        conn = TCPServer.handle_tcp(self, pkt)
        if not conn or conn.closed:
            return conn

        # check to see if we've received a complete HTTP request
        url_requested = self.extract_http_get_request(conn)
        if url_requested:
            logging.debug('A URL has been requested: ' + url_requested)
            conn.add_data_to_send(self.__make_response(url_requested, pkt))
            logging.debug('The requested URL has been sent; closing the connection')
            conn.close()
        return conn
예제 #3
0
    def handle_tcp(self, pkt):
        # take care of the usual TCP stuff
        conn = TCPServer.handle_tcp(self, pkt)
        if not conn or conn.closed:
            return conn

        # check to see if we've received a complete HTTP request
        url_requested = self.extract_http_get_request(conn)
        if url_requested:
            logging.debug('A URL has been requested: ' + url_requested)
            conn.add_data_to_send(self.__make_response(url_requested, pkt))
            logging.debug(
                'The requested URL has been sent; closing the connection')
            conn.close()
        return conn
예제 #4
0
파일: HTTPServer.py 프로젝트: dound/vns
 def __init__(self, port, serve_from, max_active_conns=25, default_page='index.html'):
     """Constructs an HTTP server listening on the specified port and serving
     files from the specified folder 'serve_from'."""
     TCPServer.__init__(self, port, max_active_conns)
     self.serve_from = serve_from
     self.default_page = default_page