Index: kresolver.cpp =================================================================== RCS file: /home/kde/kdelibs/kdecore/network/kresolver.cpp,v retrieving revision 1.32.2.9 retrieving revision 1.32.2.10 diff -b -p -u -r1.32.2.9 -r1.32.2.10 --- kdecore/network/kresolver.cpp 25 Feb 2005 12:27:55 -0000 1.32.2.9 +++ kdecore/network/kresolver.cpp 3 Mar 2005 12:35:36 -0000 1.32.2.10 @@ -278,6 +278,9 @@ void KResolverResults::virtual_hook( int /////////////////////// // class KResolver +QStringList *KResolver::idnDomains = 0; + + // default constructor KResolver::KResolver(QObject *parent, const char *name) : QObject(parent, name), d(new KResolverPrivate(this)) @@ -866,11 +869,19 @@ static QStringList splitLabels(const QSt static QCString ToASCII(const QString& label); static QString ToUnicode(const QString& label); +static QStringList *KResolver_initIdnDomains() +{ + const char *kde_use_idn = getenv("KDE_USE_IDN"); + if (!kde_use_idn) + kde_use_idn = "at:ch:cn:de:dk:kr:jp:li:no:se:tw"; + return new QStringList(QStringList::split(':', QString::fromLatin1(kde_use_idn).lower())); +} + // implement the ToAscii function, as described by IDN documents QCString KResolver::domainToAscii(const QString& unicodeDomain) { - if (getenv("KDE_USE_IDN") == 0L) - return unicodeDomain.latin1(); + if (!idnDomains) + idnDomains = KResolver_initIdnDomains(); QCString retval; // RFC 3490, section 4 describes the operation: @@ -880,6 +891,10 @@ QCString KResolver::domainToAscii(const // separators. QStringList input = splitLabels(unicodeDomain); + // Do we allow IDN names for this TLD? + if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) + return unicodeDomain.lower().latin1(); // No IDN allowed for this TLD + // 3) decide whether to enforce the STD3 rules for chars < 0x7F // we don't enforce @@ -911,8 +926,8 @@ QString KResolver::domainToUnicode(const { if (asciiDomain.isEmpty()) return asciiDomain; - if (getenv("KDE_USE_IDN") == 0L) - return asciiDomain;; + if (!idnDomains) + idnDomains = KResolver_initIdnDomains(); QString retval; @@ -924,6 +939,10 @@ QString KResolver::domainToUnicode(const // separators. QStringList input = splitLabels(asciiDomain); + // Do we allow IDN names for this TLD? + if (input.count() && !idnDomains->contains(input[input.count()-1].lower())) + return asciiDomain.lower(); // No TLDs allowed + // 3) decide whether to enforce the STD3 rules for chars < 0x7F // we don't enforce Index: kresolver.h =================================================================== RCS file: /home/kde/kdelibs/kdecore/network/kresolver.h,v retrieving revision 1.21 retrieving revision 1.21.2.1 diff -b -p -u -r1.21 -r1.21.2.1 --- kdecore/network/kresolver.h 11 Jul 2004 18:46:00 -0000 1.21 +++ kdecore/network/kresolver.h 3 Mar 2005 12:35:36 -0000 1.21.2.1 @@ -926,6 +926,8 @@ private: KResolverPrivate* d; friend class KResolverResults; friend class ::KNetwork::Internal::KResolverManager; + + static QStringList *idnDomains; }; } // namespace KNetwork Index: kio/kssl/ksslpeerinfo.cc =================================================================== RCS file: /home/kde/kdelibs/kio/kssl/ksslpeerinfo.cc,v retrieving revision 1.44 retrieving revision 1.44.6.2 diff -u -p -r1.44 -r1.44.6.2 --- kio/kssl/ksslpeerinfo.cc 29 May 2003 16:50:21 -0000 1.44 +++ kio/kssl/ksslpeerinfo.cc 4 Mar 2005 12:16:17 -0000 1.44.6.2 @@ -30,6 +30,9 @@ #include #include #include +#ifndef Q_WS_WIN //TODO kresolver not ported +#include "network/kresolver.h" +#endif #include "ksslx509map.h" @@ -59,7 +62,11 @@ void KSSLPeerInfo::setPeerHost(QString r while(d->peerHost.endsWith(".")) d->peerHost.truncate(d->peerHost.length()-1); +#ifdef Q_WS_WIN //TODO kresolver not ported d->peerHost = d->peerHost.lower(); +#else + d->peerHost = QString::fromLatin1(KNetwork::KResolver::domainToAscii(d->peerHost)); +#endif } bool KSSLPeerInfo::certMatchesAddress() {