aptdetector/network/parser/httpparser.py
def read_http_resp_header(self, reader):
        """read & parse response http headers

        Args:
            reader (DataReader): type of reader that is required
        Returns:
            `None` if not a response or any error happend , `dict` of parsed_header otherwise
        """
        line = reader.read_line()
        if line is None:
            return line
        line = line.strip()

        if not utils.is_response(line):
            return None
        resp_header = HttpResponseHeader()
        resp_header.status_line = line
        try:
            resp_header.status_code = int(line.split(' ')[1])
        except Exception:
            pass

        lines = [line]
        header_dict = self.read_headers(reader, lines)
        if b"content-length" in header_dict:
            resp_header.content_len = int(header_dict[b"content-length"])
        if b"transfer-encoding" in header_dict and b'chunked' in header_dict[
                b"transfer-encoding"]:
            resp_header.chunked = True
        resp_header.content_type = header_dict[b'content-type']
        resp_header.compress == utils.get_compress_type(header_dict[
            b"content-encoding"])
        resp_header.connection_close = (header_dict[b'connection'] == b'close')
        resp_header.raw_data = b'\n'.join(lines)
        return resp_header
read & parse response http headers

        Args:
            reader (DataReader): type of reader that is required
        Returns:
            `None` if not a response or any error happend , `dict` of parsed_header otherwise
        
read & parse response http headers
read & parse response http headers
def read_http_resp_header(self, reader):
        line = reader.read_line()
        if line is None:
            return line
        line = line.strip()
        if not utils.is_response(line):
            return None
        resp_header = HttpResponseHeader()
        resp_header.status_line = line
        try:
            resp_header.status_code = int(line.split(' ')[1])
        except Exception:
            pass
        lines = [line]
        header_dict = self.read_headers(reader, lines)
        if b"content-length" in header_dict:
            resp_header.content_len = int(header_dict[b"content-length"])
        if b"transfer-encoding" in header_dict and b'chunked' in header_dict[
                b"transfer-encoding"]:
            resp_header.chunked = True
        resp_header.content_type = header_dict[b'content-type']
        resp_header.compress == utils.get_compress_type(header_dict[
            b"content-encoding"])
        resp_header.connection_close = (header_dict[b'connection'] == b'close')
        resp_header.raw_data = b'\n'.join(lines)
        return resp_header
def read_http_resp_header ( self , reader ) : line = reader . read_line ( ) if line is None : return line line = line . strip ( ) if not utils . is_response ( line ) : return None resp_header = HttpResponseHeader ( ) resp_header . status_line = line try : resp_header . status_code = int ( line . split ( ' ' ) [ 1 ] ) except Exception : pass lines = [ line ] header_dict = self . read_headers ( reader , lines ) if b"content-length" in header_dict : resp_header . content_len = int ( header_dict [ b"content-length" ] ) if b"transfer-encoding" in header_dict and b'chunked' in header_dict [ b"transfer-encoding" ] : resp_header . chunked = True resp_header . content_type = header_dict [ b'content-type' ] resp_header . compress == utils . get_compress_type ( header_dict [ b"content-encoding" ] ) resp_header . connection_close = ( header_dict [ b'connection' ] == b'close' ) resp_header . raw_data = b'\n' . join ( lines ) return resp_header
read & parse response http headers
read & parse response http headers
"""read & parse response http headers

        Args:
            reader (DataReader): type of reader that is required
        Returns:
            `None` if not a response or any error happend , `dict` of parsed_header otherwise
        """
`None` if not a response or any error happend , `dict` of parsed_header otherwise
` None ` if not a response or any error happend ` dict ` of parsed_header otherwise
self
reader
type of reader that is required
type of reader that is required