diff options
author | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-14 10:16:27 (GMT) |
---|---|---|
committer | Qt Continuous Integration System <qt-info@nokia.com> | 2010-05-14 10:16:27 (GMT) |
commit | 03eae990b1aea880ee863061e1429edc4a96c626 (patch) | |
tree | 0ae3617d7c257fb0097ddaaa250b6ce88a1ce1a3 /src | |
parent | 01bf5e0d21c971c39473dff9e4e47324c699afaf (diff) | |
parent | c3bec5fa2dfc53051bd09a6c3c1a50b7f239ab41 (diff) | |
download | Qt-03eae990b1aea880ee863061e1429edc4a96c626.zip Qt-03eae990b1aea880ee863061e1429edc4a96c626.tar.gz Qt-03eae990b1aea880ee863061e1429edc4a96c626.tar.bz2 |
Merge branch '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2 into 4.6-integration
* '4.6' of scm.dev.nokia.troll.no:qt/oslo-staging-2:
Fix QUrl::isValid if the host contains invalid caracter.
QUrl: parsing of host name with an undercore.
Diffstat (limited to 'src')
-rw-r--r-- | src/corelib/io/qurl.cpp | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index bdb0cfd..5119ccc 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -338,6 +338,7 @@ public: bool hasQuery; bool hasFragment; bool isValid; + bool isHostValid; char valueDelimiter; char pairDelimiter; @@ -2990,7 +2991,9 @@ bool qt_check_std3rules(const QChar *uc, int len) // only LDH is present if (c == '-' || (c >= '0' && c <= '9') || (c >= 'A' && c <= 'Z') - || (c >= 'a' && c <= 'z')) + || (c >= 'a' && c <= 'z') + //underscore is not supposed to be allowed, but other browser accept it (QTBUG-7434) + || c == '_') continue; return false; @@ -3345,6 +3348,7 @@ QUrlPrivate::QUrlPrivate() ref = 1; port = -1; isValid = false; + isHostValid = true; parsingMode = QUrl::TolerantMode; valueDelimiter = '='; pairDelimiter = '&'; @@ -3371,6 +3375,7 @@ QUrlPrivate::QUrlPrivate(const QUrlPrivate ©) hasQuery(copy.hasQuery), hasFragment(copy.hasFragment), isValid(copy.isValid), + isHostValid(copy.isHostValid), valueDelimiter(copy.valueDelimiter), pairDelimiter(copy.pairDelimiter), stateFlags(copy.stateFlags), @@ -3401,6 +3406,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; } @@ -3477,6 +3484,7 @@ QString QUrlPrivate::authority(QUrl::FormattingOptions options) const void QUrlPrivate::setAuthority(const QString &auth) { + isHostValid = true; if (auth.isEmpty()) return; @@ -4167,7 +4175,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; } /*! @@ -4419,7 +4427,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); } @@ -4640,6 +4647,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; |