View | Details | Raw Unified | Return to bug 65566
Collapse All | Expand All

(-)kdecore/network/kresolver.cpp (-4 / +23 lines)
Lines 278-283 void KResolverResults::virtual_hook( int Link Here
278
///////////////////////
278
///////////////////////
279
// class KResolver
279
// class KResolver
280
280
281
QStringList *KResolver::idnDomains = 0;
282
283
281
// default constructor
284
// default constructor
282
KResolver::KResolver(QObject *parent, const char *name)
285
KResolver::KResolver(QObject *parent, const char *name)
283
  : QObject(parent, name), d(new KResolverPrivate(this))
286
  : QObject(parent, name), d(new KResolverPrivate(this))
Lines 866-876 static QStringList splitLabels(const QSt Link Here
866
static QCString ToASCII(const QString& label);
869
static QCString ToASCII(const QString& label);
867
static QString ToUnicode(const QString& label);
870
static QString ToUnicode(const QString& label);
868
  
871
  
872
static QStringList *KResolver_initIdnDomains()
873
{
874
  const char *kde_use_idn = getenv("KDE_USE_IDN");
875
  if (!kde_use_idn)
876
     kde_use_idn = "at:ch:cn:de:dk:kr:jp:li:no:se:tw";
877
  return new QStringList(QStringList::split(':', QString::fromLatin1(kde_use_idn).lower()));
878
}
879
869
// implement the ToAscii function, as described by IDN documents
880
// implement the ToAscii function, as described by IDN documents
870
QCString KResolver::domainToAscii(const QString& unicodeDomain)
881
QCString KResolver::domainToAscii(const QString& unicodeDomain)
871
{
882
{
872
  if (getenv("KDE_USE_IDN") == 0L)
883
  if (!idnDomains)
873
    return unicodeDomain.latin1();
884
    idnDomains = KResolver_initIdnDomains();
874
885
875
  QCString retval;
886
  QCString retval;
876
  // RFC 3490, section 4 describes the operation:
887
  // RFC 3490, section 4 describes the operation:
Lines 880-885 QCString KResolver::domainToAscii(const Link Here
880
  // separators.
891
  // separators.
881
  QStringList input = splitLabels(unicodeDomain);
892
  QStringList input = splitLabels(unicodeDomain);
882
893
894
  // Do we allow IDN names for this TLD?
895
  if (input.count() && !idnDomains->contains(input[input.count()-1].lower()))
896
    return unicodeDomain.latin1(); // No IDN allowed for this TLD
897
883
  // 3) decide whether to enforce the STD3 rules for chars < 0x7F
898
  // 3) decide whether to enforce the STD3 rules for chars < 0x7F
884
  // we don't enforce
899
  // we don't enforce
885
900
Lines 911-918 QString KResolver::domainToUnicode(const Link Here
911
{
926
{
912
  if (asciiDomain.isEmpty())
927
  if (asciiDomain.isEmpty())
913
    return asciiDomain;
928
    return asciiDomain;
914
  if (getenv("KDE_USE_IDN") == 0L)
929
  if (!idnDomains)
915
    return asciiDomain;;
930
    idnDomains = KResolver_initIdnDomains();
916
931
917
  QString retval;
932
  QString retval;
918
933
Lines 924-929 QString KResolver::domainToUnicode(const Link Here
924
  // separators.
939
  // separators.
925
  QStringList input = splitLabels(asciiDomain);
940
  QStringList input = splitLabels(asciiDomain);
926
941
942
  // Do we allow IDN names for this TLD?
943
  if (input.count() && !idnDomains->contains(input[input.count()-1].lower()))
944
    return asciiDomain; // No TLDs allowed
945
927
  // 3) decide whether to enforce the STD3 rules for chars < 0x7F
946
  // 3) decide whether to enforce the STD3 rules for chars < 0x7F
928
  // we don't enforce
947
  // we don't enforce
929
948
(-)kdecore/network/kresolver.h (+2 lines)
Lines 926-931 private: Link Here
926
  KResolverPrivate* d;
926
  KResolverPrivate* d;
927
  friend class KResolverResults;
927
  friend class KResolverResults;
928
  friend class ::KNetwork::Internal::KResolverManager;
928
  friend class ::KNetwork::Internal::KResolverManager;
929
  
930
  static QStringList *idnDomains;
929
};
931
};
930
932
931
}				// namespace KNetwork
933
}				// namespace KNetwork
(-)kio/kssl/ksslpeerinfo.cc (+7 lines)
Lines 30-35 Link Here
30
#include <ksockaddr.h>
30
#include <ksockaddr.h>
31
#include <kextsock.h>
31
#include <kextsock.h>
32
#include <netsupp.h>
32
#include <netsupp.h>
33
#ifndef Q_WS_WIN //TODO kresolver not ported
34
#include "kresolver.h"
35
#endif
33
36
34
#include "ksslx509map.h"
37
#include "ksslx509map.h"
35
38
Lines 59-65 void KSSLPeerInfo::setPeerHost(QString r Link Here
59
	while(d->peerHost.endsWith("."))
62
	while(d->peerHost.endsWith("."))
60
		d->peerHost.truncate(d->peerHost.length()-1);
63
		d->peerHost.truncate(d->peerHost.length()-1);
61
64
65
#ifdef Q_WS_WIN //TODO kresolver not ported
62
	d->peerHost = d->peerHost.lower();
66
	d->peerHost = d->peerHost.lower();
67
#else	
68
	d->peerHost = QString::fromLatin1(KNetwork::KResolver::domainToAscii(d->peerHost));
69
#endif	
63
}
70
}
64
71
65
bool KSSLPeerInfo::certMatchesAddress() {
72
bool KSSLPeerInfo::certMatchesAddress() {

Return to bug 65566