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

(-)kidna.cpp (-3 / +20 lines)
Lines 21-26 Link Here
21
21
22
#include "kidna.h"
22
#include "kidna.h"
23
23
24
#include <qstringlist.h>
24
#include <kdebug.h>
25
#include <kdebug.h>
25
26
26
#include "ltdl.h"
27
#include "ltdl.h"
Lines 65-70 static void KIDNA_load_lib() Link Here
65
   KIDNA_lib_load_failed = false; // Succes
66
   KIDNA_lib_load_failed = false; // Succes
66
}
67
}
67
68
69
static QStringList *KIDNA_idnDomains = 0;
70
71
static bool idnSupportForHost(const QString &host)
72
{
73
   if (!KIDNA_idnDomains)
74
   {
75
      const char *kde_use_idn = getenv("KDE_USE_IDN");
76
      if (!kde_use_idn)
77
         kde_use_idn = "at:ch:cn:de:dk:kr:jp:li:no:se:tw";
78
      KIDNA_idnDomains = new QStringList(QStringList::split(':', QString::fromLatin1(kde_use_idn).lower()));
79
   }
80
   
81
   QString tld = host.mid(host.findRev('.')+1).lower();
82
   return KIDNA_idnDomains->contains(tld);
83
}
84
68
QCString KIDNA::toAsciiCString(const QString &idna)
85
QCString KIDNA::toAsciiCString(const QString &idna)
69
{
86
{
70
   int l = idna.length();
87
   int l = idna.length();
Lines 86-92 QCString KIDNA::toAsciiCString(const QSt Link Here
86
      KIDNA_load_lib();
103
      KIDNA_load_lib();
87
   }
104
   }
88
105
89
   if (KIDNA_lib_load_failed)
106
   if (KIDNA_lib_load_failed || !idnSupportForHost(idna))
90
   {
107
   {
91
      return 0; // Can't convert
108
      return 0; // Can't convert
92
   }
109
   }
Lines 132-138 QString KIDNA::toAscii(const QString &id Link Here
132
      KIDNA_load_lib();
149
      KIDNA_load_lib();
133
   }
150
   }
134
151
135
   if (KIDNA_lib_load_failed)
152
   if (KIDNA_lib_load_failed || !idnSupportForHost(idna))
136
   {
153
   {
137
      return QString::null; // Can't convert
154
      return QString::null; // Can't convert
138
   }
155
   }
Lines 164-170 QString KIDNA::toUnicode(const QString & Link Here
164
      KIDNA_load_lib();
181
      KIDNA_load_lib();
165
   }
182
   }
166
183
167
   if (KIDNA_lib_load_failed)
184
   if (KIDNA_lib_load_failed || !idnSupportForHost(idna))
168
   {
185
   {
169
      return idna.lower(); // Return as is
186
      return idna.lower(); // Return as is
170
   }
187
   }
(-)kssl/ksslpeerinfo.cc (-1 / +2 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
#include "kidna.h"
33
34
34
#include "ksslx509map.h"
35
#include "ksslx509map.h"
35
36
Lines 59-65 void KSSLPeerInfo::setPeerHost(QString r Link Here
59
	while(d->peerHost.endsWith("."))
60
	while(d->peerHost.endsWith("."))
60
		d->peerHost.truncate(d->peerHost.length()-1);
61
		d->peerHost.truncate(d->peerHost.length()-1);
61
62
62
	d->peerHost = d->peerHost.lower();
63
	d->peerHost = KIDNA::toAscii(d->peerHost);
63
}
64
}
64
65
65
bool KSSLPeerInfo::certMatchesAddress() {
66
bool KSSLPeerInfo::certMatchesAddress() {

Return to bug 65566