def header_dict_from_list(array):
    """Given a list of strings in http header format, return a dict.
    If array is None, return None"""
    if array is None:
        return array
    header_dict = {}
    for item in array:
        (key, sep, value) = item.partition(':')
        if sep and value:
            header_dict[key.strip()] = value.strip()
    return header_dict