根据 req_headers, res_headers 判断改消息是否为 304

def fresh(req_headers: HEADER_TYPE, res_headers: HEADER_TYPE) -> bool:
    """
    根据 req_headers, res_headers 判断改消息是否为 304
    """
    modified_since = cast(
        Optional[str],
        req_headers.get('if-modified-since'),
    )
    none_match = cast(
        Optional[str],
        req_headers.get('if-none-match'),
    )
    if not modified_since and not none_match:
        return False
    cache_control = req_headers.get('cache-control')
    if cache_control is not None:
        if isinstance(cache_control, list):
            for control in cache_control:
                if control.strip() == "no-cache":
                    return False
        elif cache_control.strip() == "no-cache":
            return False
    if none_match is not None and none_match != "*":
        etag = cast(
            Optional[str],
            res_headers.get('ETag') or res_headers.get('etag'),
        )
        if etag is None:
            return False
        if etag.startswith("W/"):
            etag = etag[2:]
        if none_match.startswith("W/"):
            none_match = none_match[2:]
        etag_stale = True
        matches = none_match.split(",")
        for match in matches:
            match = match.strip()
            if match == etag:
                etag_stale = False
                break
        if etag_stale:
            return False
    if modified_since:
        last_modified = cast(
            Optional[str],
            res_headers.get('Last-Modified') or res_headers.get('last-modified'),
        )
        modified_stale = True
        if last_modified is not None:
            last_date = parse_http_date(last_modified)
            modified_date = parse_http_date(modified_since)
            if last_date != 0 and modified_date != 0 and last_date <= modified_date:
                modified_stale = False
        if modified_stale:
            return False
    return True