if (parseData.scheme) {
QByteArray s(parseData.scheme, parseData.schemeLength);
- that->scheme = fromPercentEncodingMutable(&s);
+ that->scheme = fromPercentEncodingMutable(&s).toLower();
}
that->setEncodedUserInfo(&parseData);
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
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
{
QUrl url("hTTp://www.foo.bar:80");
QVERIFY(url.isValid());
- QCOMPARE(url.scheme(), QString::fromLatin1("hTTp"));
+ QCOMPARE(url.scheme(), QString::fromLatin1("http"));
QCOMPARE(url.path(), QString());
QVERIFY(url.encodedQuery().isEmpty());
QVERIFY(url.userInfo().isEmpty());
QCOMPARE(url.port(), 80);
QUrl url2("//www1.foo.bar");
- QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("hTTp://www1.foo.bar"));
+ QCOMPARE(url.resolved(url2).toString(), QString::fromLatin1("http://www1.foo.bar"));
}
{