def is_base64_processing_needed(content_type, content_encoding): content_encodings = utils.get_accepted_encodings_direct(content_encoding) if content_encodings: if 'base64' not in content_encodings: return False if is_supported(content_type): encodings = CTYPES_TO_ENCODINGS[INTERNAL_CTYPES[content_type]] return encodings and 'base64' in encodings return False
def use_binary_content_as_is(content_type, content_encoding): """Checks if headers are valid to allow binary content as-is.""" content_encodings = utils.get_accepted_encodings_direct(content_encoding) if content_encodings: if 'binary' not in content_encodings: return False if is_supported(content_type): encodings = CTYPES_TO_ENCODINGS[INTERNAL_CTYPES.get(content_type)] return encodings and 'binary' in encodings return INTERNAL_CTYPES.get(content_type) in BINARY