Staging
v0.5.1
https://github.com/python/cpython
Revision 66e5742becce38e69a8f09e5f7051445fc57e92e authored by Christian Heimes on 29 January 2018, 13:25:13 UTC, committed by GitHub on 29 January 2018, 13:25:13 UTC
Add test cases for IDNA 2003 and 2008 host names. IDNA 2003
internationalized host names are working since bpo-31399 has landed. IDNA
2008 deviations are still broken and will be fixed in another patch.

Signed-off-by: Christian Heimes <christian@python.org>
1 parent 892d66e
Raw File
Tip revision: 66e5742becce38e69a8f09e5f7051445fc57e92e authored by Christian Heimes on 29 January 2018, 13:25:13 UTC
bpo-28414: ssl module idna test (#5395)
Tip revision: 66e5742
pystrcmp.c
/* Cross platform case insensitive string compare functions
 */

#include "Python.h"

int
PyOS_mystrnicmp(const char *s1, const char *s2, Py_ssize_t size)
{
    if (size == 0)
        return 0;
    while ((--size > 0) &&
           (tolower((unsigned)*s1) == tolower((unsigned)*s2))) {
        if (!*s1++ || !*s2++)
            break;
    }
    return tolower((unsigned)*s1) - tolower((unsigned)*s2);
}

int
PyOS_mystricmp(const char *s1, const char *s2)
{
    while (*s1 && (tolower((unsigned)*s1++) == tolower((unsigned)*s2++))) {
        ;
    }
    return (tolower((unsigned)*s1) - tolower((unsigned)*s2));
}
back to top