summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.cpp
diff options
context:
space:
mode:
authorOlivier Goffart <olivier.goffart@nokia.com>2010-05-17 20:00:03 +0200
committerOlivier Goffart <olivier.goffart@nokia.com>2010-05-17 20:00:03 +0200
commit91a1f7a1c408052b1d284d6b901819964e338fe5 (patch)
treedf7103f0ea0cb9d98f4b641d72c0f8b0ebdf2498 /src/corelib/io/qurl.cpp
parent94a3356d5eb7b255d439efe2699bf3a9b025e8eb (diff)
parent509ef11ab4ba6165c16d9d311c4a1bf7cdfd2528 (diff)
Merge remote branch 'origin/4.6' into qt-4.7-from-4.6
Conflicts: demos/demos.pro mkspecs/features/resources.prf mkspecs/features/uic.prf src/corelib/io/qurl.cpp src/corelib/tools/qlocale_symbian.cpp src/gui/graphicsview/qgraphicsscene.cpp src/gui/graphicsview/qgraphicswidget_p.cpp src/gui/graphicsview/qgraphicswidget_p.h src/gui/util/qsystemtrayicon_win.cpp src/multimedia/audio/qaudioinput.cpp tests/auto/qhostinfo/qhostinfo.pro
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-rw-r--r--src/corelib/io/qurl.cpp19
1 files changed, 15 insertions, 4 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index d4b8b5febb..79a8ce40be 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -345,6 +345,7 @@ public:
bool hasQuery;
bool hasFragment;
bool isValid;
+ bool isHostValid;
char valueDelimiter;
char pairDelimiter;
@@ -3138,10 +3139,11 @@ static void toPunycodeHelper(const QChar *s, int ucLength, QString *output)
static const char * const idn_whitelist[] = {
- "ac", "at",
- "br",
+ "ac", "ar", "at",
+ "biz", "br",
"cat", "ch", "cl", "cn",
"de", "dk",
+ "es",
"fi",
"gr",
"hu",
@@ -3155,6 +3157,9 @@ static const char * const idn_whitelist[] = {
"se", "sh",
"th", "tm", "tw",
"vn",
+ "xn--mgbaam7a8h", // UAE
+ "xn--mgberp4a5d4ar", // Saudi Arabia
+ "xn--wgbh1c" // Egypt
};
static QStringList *user_idn_whitelist = 0;
@@ -3313,6 +3318,7 @@ static QString qt_ACE_do(const QString &domain, AceOperation op)
qt_nameprep(&result, prevLen);
labelLength = result.length() - prevLen;
register int toReserve = labelLength + 4 + 6; // "xn--" plus some extra bytes
+ aceForm.resize(0);
if (toReserve > aceForm.capacity())
aceForm.reserve(toReserve);
toPunycodeHelper(result.constData() + prevLen, result.size() - prevLen, &aceForm);
@@ -3349,6 +3355,7 @@ QUrlPrivate::QUrlPrivate()
ref = 1;
port = -1;
isValid = false;
+ isHostValid = true;
parsingMode = QUrl::TolerantMode;
valueDelimiter = '=';
pairDelimiter = '&';
@@ -3375,6 +3382,7 @@ QUrlPrivate::QUrlPrivate(const QUrlPrivate &copy)
hasQuery(copy.hasQuery),
hasFragment(copy.hasFragment),
isValid(copy.isValid),
+ isHostValid(copy.isHostValid),
valueDelimiter(copy.valueDelimiter),
pairDelimiter(copy.pairDelimiter),
stateFlags(copy.stateFlags),
@@ -3405,6 +3413,8 @@ QString QUrlPrivate::canonicalHost() const
that->host = host.toLower();
} else {
that->host = qt_ACE_do(host, NormalizeAce);
+ if (that->host.isNull())
+ that->isHostValid = false;
}
return that->host;
}
@@ -3481,6 +3491,7 @@ QString QUrlPrivate::authority(QUrl::FormattingOptions options) const
void QUrlPrivate::setAuthority(const QString &auth)
{
+ isHostValid = true;
if (auth.isEmpty()) {
setUserInfo(QString());
host.clear();
@@ -4175,7 +4186,7 @@ bool QUrl::isValid() const
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Validated)) d->validate();
- return d->isValid;
+ return d->isValid && d->isHostValid;
}
/*!
@@ -4427,7 +4438,6 @@ void QUrl::setAuthority(const QString &authority)
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized);
-
d->setAuthority(authority);
}
@@ -4648,6 +4658,7 @@ void QUrl::setHost(const QString &host)
if (!d) d = new QUrlPrivate;
if (!QURL_HASFLAG(d->stateFlags, QUrlPrivate::Parsed)) d->parse();
detach();
+ d->isHostValid = true;
QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized | QUrlPrivate::HostCanonicalized);
d->host = host;