diff options
author | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-18 16:52:45 (GMT) |
---|---|---|
committer | Thiago Macieira <thiago.macieira@nokia.com> | 2009-08-20 10:36:50 (GMT) |
commit | c7c7b364d9816d03c7475d6592d50dec5401c151 (patch) | |
tree | f24fcc1bca4108b990fdce9eb856b2e00c2a8b93 /src/network/kernel/qhostinfo.cpp | |
parent | 909cdf082fd99ce8bdcb99a9db38d09f52d869aa (diff) | |
download | Qt-c7c7b364d9816d03c7475d6592d50dec5401c151.zip Qt-c7c7b364d9816d03c7475d6592d50dec5401c151.tar.gz Qt-c7c7b364d9816d03c7475d6592d50dec5401c151.tar.bz2 |
Fix literal IPv6 hostname resolution in QHostInfo.
With the series of commits ending in ff1280178, I made QUrl::toAce
fail if the parameter is not a well-formed hostname (i.e., if it
violates STD3). IPv6 hostnames do, so we can't preemptively run
ToACE.
Instead, delay running ToACE until we've tried literal matching.
Reviewed-by: TrustMe
Diffstat (limited to 'src/network/kernel/qhostinfo.cpp')
-rw-r--r-- | src/network/kernel/qhostinfo.cpp | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/src/network/kernel/qhostinfo.cpp b/src/network/kernel/qhostinfo.cpp index ee1369d..77b2a7e 100644 --- a/src/network/kernel/qhostinfo.cpp +++ b/src/network/kernel/qhostinfo.cpp @@ -162,16 +162,13 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, QWindowsSockInit bust; // makes sure WSAStartup was callled #endif - // Support for IDNA - QString lookup = QString::fromLatin1(QUrl::toAce(name)); - QHostInfoResult *result = new QHostInfoResult; result->autoDelete = false; QObject::connect(result, SIGNAL(resultsReady(QHostInfo)), receiver, member); int id = result->lookupId = theIdCounter.fetchAndAddRelaxed(1); - if (lookup.isEmpty()) { + if (name.isEmpty()) { QHostInfo info(id); info.setError(QHostInfo::HostNotFound); info.setErrorString(QObject::tr("No host name given")); @@ -182,7 +179,7 @@ int QHostInfo::lookupHost(const QString &name, QObject *receiver, } QHostInfoAgent *agent = theAgent(); - agent->addHostName(lookup, result); + agent->addHostName(name, result); #if !defined QT_NO_THREAD if (!agent->isRunning()) @@ -226,13 +223,7 @@ QHostInfo QHostInfo::fromName(const QString &name) qDebug("QHostInfo::fromName(\"%s\")",name.toLatin1().constData()); #endif - if (!name.isEmpty()) - return QHostInfoAgent::fromName(QLatin1String(QUrl::toAce(name))); - - QHostInfo retval; - retval.d->err = HostNotFound; - retval.d->errorStr = QObject::tr("No host name given"); - return retval; + return QHostInfoAgent::fromName(name); } /*! |