def __init__(self, handler_class, port, ip='', keyfile=None, certfile=None):
"""Initialize new TcpIpHttpEndpoint object
Args:
handler_class (obj): a request handler class that will be handling
requests received by internal httpd server
port (int): tcp port that httpd server will listen on
ip (str): ip address that httpd server will listen on, by default
listen on all addresses
"""
if certfile is not None and keyfile is not None:
endpoint_id = "https://{}:{}".format(ip, port)
else:
endpoint_id = "http://{}:{}".format(ip, port)
super().__init__(endpoint_id)
self._context.data['listen_ip'] = ip
self._context.data['listen_port'] = port
self._context.data['certfile'] = certfile
self._context.data['keyfile'] = keyfile
self._handler_class = handler_class
self.__setup_httpd_thread(ip, port)
评论列表
文章目录