from typing import List


def header_content_split(string: str, delimiter: str) -> List[str]:
    """
    Take a string and split it according to the passed delimiter.
    It will ignore delimiter if inside between double quote, inside a value, or in parenthesis.
    The input string is considered perfectly formed. This function does not split coma on a day
    when attached, see "RFC 7231, section 7.1.1.2: Date".
    >>> header_content_split("Wed, 15-Apr-2020 21:27:31 GMT, Fri, 01-Jan-2038 00:00:00 GMT", ",")
    ['Wed, 15-Apr-2020 21:27:31 GMT', 'Fri, 01-Jan-2038 00:00:00 GMT']
    >>> header_content_split('quic=":443"; ma=2592000; v="46,43", h3-Q050=":443"; ma=2592000, h3-Q049=":443"; ma=2592000', ",")
    ['quic=":443"; ma=2592000; v="46,43"', 'h3-Q050=":443"; ma=2592000', 'h3-Q049=":443"; ma=2592000']
    >>> header_content_split("Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0", ";")
    ['Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:50.0) Gecko/20100101 Firefox/50.0']
    >>> header_content_split("text/html; charset=UTF-8", ";")
    ['text/html', 'charset=UTF-8']
    >>> header_content_split('text/html; charset="UTF-\\\"8"', ";")
    ['text/html', 'charset="UTF-"8"']
    """
    if len(delimiter) != 1 or delimiter not in {";", ",", " "}:
        raise ValueError("Delimiter should be either semi-colon, a coma or a space.")

    in_double_quote: bool = False
    in_parenthesis: bool = False
    in_value: bool = False
    is_on_a_day: bool = False

    result: List[str] = [""]

    for letter, index in zip(string, range(0, len(string))):

        if letter == '"':
            in_double_quote = not in_double_quote

            if in_value and not in_double_quote:
                in_value = False

        elif letter == "(" and not in_parenthesis:
            in_parenthesis = True
        elif letter == ")" and in_parenthesis:
            in_parenthesis = False
        else:
            is_on_a_day = index >= 3 and string[index - 3 : index] in {
                "Mon",
                "Tue",
                "Wed",
                "Thu",
                "Fri",
                "Sat",
                "Sun",
            }

        if not in_double_quote:

            if not in_value and letter == "=":
                in_value = True
            elif letter == ";" and in_value:
                in_value = False

            if in_value and letter == delimiter and not is_on_a_day:
                in_value = False

        if letter == delimiter and (
            (in_value or in_double_quote or in_parenthesis or is_on_a_day) is False
        ):

            result[-1] = result[-1].lstrip().rstrip()
            result.append("")

            continue

        result[-1] += letter

    if result:
        result[-1] = result[-1].lstrip().rstrip()

    return result