Index: kresolver.cpp
===================================================================
RCS file: /home/kde/kdelibs/kdecore/network/kresolver.cpp,v
retrieving revision 1.32.2.8
retrieving revision 1.32.2.11
diff -u -p -r1.32.2.8 -r1.32.2.11
--- kdecore/network/kresolver.cpp       13 Jan 2005 19:10:37 -0000      1.32.2.8
+++ kdecore/network/kresolver.cpp       16 Mar 2005 04:03:06 -0000      1.32.2.11
@@ -32,6 +32,7 @@
#include <time.h>
#include <arpa/inet.h>
#include <netinet/in.h>
+#include <stdlib.h>

// Qt includes
#include <qapplication.h>
@@ -277,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))
@@ -864,10 +868,21 @@ QStrList KResolver::serviceName(int port
static QStringList splitLabels(const QString& unicodeDomain);
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 (!idnDomains)
+    idnDomains = KResolver_initIdnDomains();
+
  QCString retval;
  // RFC 3490, section 4 describes the operation:
  // 1) this is a query, so don't allow unassigned
@@ -876,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

@@ -907,6 +926,8 @@ QString KResolver::domainToUnicode(const
{
  if (asciiDomain.isEmpty())
    return asciiDomain;
+  if (!idnDomains)
+    idnDomains = KResolver_initIdnDomains();

  QString retval;

@@ -918,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 <ksockaddr.h>
#include <kextsock.h>
#include <netsupp.h>
+#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() {