def __init__(self, server, source, sock, address, request_parser, content_type, http_response = None): if http_response is None: http_response = HTTPResponse( 200, b'OK', {b'Content-Length': None, b'Content-Type': content_type}, ) HTTPEventHandler.__init__(self, server, sock, address, request_parser, http_response) self.source = source
def __init__(self, server, source, sock, address, request_parser, content_type, http_response = None): if http_response is None: http_response = HTTPResponse( 200, b'OK', {b'Content-Length': None, b'Content-Type': content_type}, ) HTTPEventHandler.__init__(self, server, sock, address, request_parser, http_response) self.source = source self.timeout_state = False self.server.remove_inactivity_timeout(self)
def __init__(self, server, sock, address, request_parser): sources_dict = {} total_clients_number = 0 for path, sources in server.sources.items(): sources_dict[path] = {} for source, source_dict in sources.items(): source_address = '%s:%s' % source.address sources_dict[path][source_address] = {} for fd, client in source_dict['clients'].items(): sources_dict[path][source_address][fd] = '%s:%s' % client.address total_clients_number += 1 status_dict = { 'total_clients_number': total_clients_number, 'pid': os.getpid(), 'sources': sources_dict, } HTTPEventHandler.__init__(self, server, sock, address, request_parser, 200, b'OK', {b'Content-Type': 'application/json'}, json.dumps(status_dict, indent = 4) + '\n')
def __init__(self, server, source, sock, address, request_parser, content_type, http_response=None): if http_response is None: http_response = HTTPResponse( 200, b'OK', { b'Content-Length': None, b'Content-Type': content_type }, ) HTTPEventHandler.__init__(self, server, sock, address, request_parser, http_response) self.source = source self.timeout_state = False self.server.remove_inactivity_timeout(self)
def __init__(self, server, source, sock, address, request_parser, content_type): HTTPEventHandler.__init__(self, server, sock, address, request_parser, 200, b'OK', {b'Content-Length': None, b'Content-Type': content_type}) self.source = source
def __init__(self, server, sock, address, request_parser): HTTPEventHandler.__init__(self, server, sock, address, request_parser, 200, b'OK', {b'Content-Type': 'text/plain'}, pprint.pformat(server.sources))