static bool rfc2253_string_compare(
        const std::string& str1,
        const std::string& str2)
{
    bool returned_value = true;

    size_t str1_mark_low = 0, str1_mark_high = 0, str2_mark_low = 0, str2_mark_high = 0;

    str1_mark_high = str1.find_first_of(',');
    if (str1_mark_high == std::string::npos)
    {
        str1_mark_high = str1.length();
    }
    str2_mark_high = str2.find_first_of(',');
    if (str2_mark_high == std::string::npos)
    {
        str2_mark_high = str2.length();
    }

    while (str1_mark_low < str1_mark_high && str2_mark_low < str2_mark_high)
    {
        // Trim
        size_t str1_trim_high = str1_mark_high - 1, str2_trim_high = str2_mark_high - 1;

        while (str1.at(str1_mark_low) == ' ' && (str1_mark_low + 1) != str1_trim_high)
        {
            ++str1_mark_low;
        }
        while (str2.at(str2_mark_low) == ' ' && (str2_mark_low + 1) != str2_trim_high)
        {
            ++str2_mark_low;
        }
        while (str1.at(str1_trim_high) == ' ' && (str1_trim_high - 1) != str1_mark_low)
        {
            --str1_trim_high;
        }
        while (str2.at(str2_trim_high) == ' ' && (str2_trim_high - 1) != str2_mark_low)
        {
            --str2_trim_high;
        }

        if (str1.compare(str1_mark_low, str1_trim_high - str1_mark_low + 1, str2,
                str2_mark_low, str2_trim_high - str2_mark_low + 1) != 0)
        {
            returned_value = false;
            break;
        }

        str1_mark_low = str1_mark_high + 1;
        str2_mark_low = str2_mark_high + 1;
        str1_mark_high = str1.find_first_of(',', str1_mark_low);
        if (str1_mark_high == std::string::npos)
        {
            str1_mark_high = str1.length();
        }
        str2_mark_high = str2.find_first_of(',', str2_mark_low);
        if (str2_mark_high == std::string::npos)
        {
            str2_mark_high = str2.length();
        }
    }

    if (str1_mark_low < str1_mark_high || str2_mark_low < str2_mark_high)
    {
        returned_value = false;
    }

    return returned_value;
}
static bool rfc2253_string_compare(
        const std::string& str1,
        const std::string& str2)
{
    bool returned_value = true;

    size_t str1_mark_low = 0, str1_mark_high = 0, str2_mark_low = 0, str2_mark_high = 0;

    str1_mark_high = str1.find_first_of(',');
    if (str1_mark_high == std::string::npos)
    {
        str1_mark_high = str1.length();
    }
    str2_mark_high = str2.find_first_of(',');
    if (str2_mark_high == std::string::npos)
    {
        str2_mark_high = str2.length();
    }

    while (str1_mark_low < str1_mark_high && str2_mark_low < str2_mark_high)
    {
         
        size_t str1_trim_high = str1_mark_high - 1, str2_trim_high = str2_mark_high - 1;

        while (str1.at(str1_mark_low) == ' ' && (str1_mark_low + 1) != str1_trim_high)
        {
            ++str1_mark_low;
        }
        while (str2.at(str2_mark_low) == ' ' && (str2_mark_low + 1) != str2_trim_high)
        {
            ++str2_mark_low;
        }
        while (str1.at(str1_trim_high) == ' ' && (str1_trim_high - 1) != str1_mark_low)
        {
            --str1_trim_high;
        }
        while (str2.at(str2_trim_high) == ' ' && (str2_trim_high - 1) != str2_mark_low)
        {
            --str2_trim_high;
        }

        if (str1.compare(str1_mark_low, str1_trim_high - str1_mark_low + 1, str2,
                str2_mark_low, str2_trim_high - str2_mark_low + 1) != 0)
        {
            returned_value = false;
            break;
        }

        str1_mark_low = str1_mark_high + 1;
        str2_mark_low = str2_mark_high + 1;
        str1_mark_high = str1.find_first_of(',', str1_mark_low);
        if (str1_mark_high == std::string::npos)
        {
            str1_mark_high = str1.length();
        }
        str2_mark_high = str2.find_first_of(',', str2_mark_low);
        if (str2_mark_high == std::string::npos)
        {
            str2_mark_high = str2.length();
        }
    }

    if (str1_mark_low < str1_mark_high || str2_mark_low < str2_mark_high)
    {
        returned_value = false;
    }

    return returned_value;
}