diff options
author | David Faure <faure@kde.org> | 2012-01-24 14:51:51 +0100 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-01-24 15:27:08 +0100 |
commit | 84bdb7b61f79402b238e903fc18fd62e565e1563 (patch) | |
tree | 06652ad1d26b146c1221427c2661ac174935b7d8 /src/corelib | |
parent | 0e06e47a0b37c3741a9501980e743530aab538d0 (diff) |
Make QUrl always lowercase the scheme().
URL schemes can only contain alphanumeric characters and all
protocols specify that they are case-insensitive. So instead
of doing case-insensitive comparison everywhere and then get
it wrong sometimes, better to lower-case it here.
Change-Id: I61f51a3f4c85b90af1586ebcf69608987fbe2ec3
Reviewed-by: Jonas Gastal <jgastal@profusion.mobi>
Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qurl.cpp | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 2c75ac3e0d..9856d5defa 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -3880,7 +3880,7 @@ void QUrlPrivate::parse(ParseOptions parseOptions) const if (parseData.scheme) { QByteArray s(parseData.scheme, parseData.schemeLength); - that->scheme = fromPercentEncodingMutable(&s); + that->scheme = fromPercentEncodingMutable(&s).toLower(); } that->setEncodedUserInfo(&parseData); @@ -4041,7 +4041,6 @@ const QByteArray &QUrlPrivate::normalized() const QURL_SETFLAG(that->stateFlags, QUrlPrivate::Normalized); QUrlPrivate tmp = *this; - tmp.scheme = tmp.scheme.toLower(); tmp.host = tmp.canonicalHost(); // ensure the encoded and normalized parts of the URL @@ -4467,13 +4466,15 @@ void QUrl::setScheme(const QString &scheme) detach(); QURL_UNSETFLAG(d->stateFlags, QUrlPrivate::Validated | QUrlPrivate::Normalized); - d->scheme = scheme; + d->scheme = scheme.toLower(); } /*! Returns the scheme of the URL. If an empty string is returned, this means the scheme is undefined and the URL is then relative. + The returned scheme is always lowercase, for convenience. + \sa setScheme(), isRelative() */ QString QUrl::scheme() const |