diff options
author | David Faure <faure@kde.org> | 2012-05-14 17:17:11 +0200 |
---|---|---|
committer | Qt by Nokia <qt-info@nokia.com> | 2012-05-14 17:36:57 +0200 |
commit | 5764f5e6eaf149116a818658883cf4fae9830f30 (patch) | |
tree | 23529f990d031b0c5791a3499e8b09c4fe803988 /src/corelib | |
parent | feb212e1e5f64111ed061b474bb2e6b8c3886acb (diff) |
QUrl: using sectionIsPresent in operator== broke for local files.
QUrl::fromLocalFile("/foo") doesn't set Host, but QUrl("file:///foo")
does (to remember that it saw a Host section, even if empty, which is
useful for urls like "remote://"). So ignore the Host flag in operator==.
Change-Id: I4322b4a75420c4e42766c0d65c1b121f28028a76
Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
Diffstat (limited to 'src/corelib')
-rw-r--r-- | src/corelib/io/qurl.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index 07024d3ba8..68523cd3d4 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -2382,7 +2382,11 @@ bool QUrl::operator ==(const QUrl &url) const return url.d->isEmpty(); if (!url.d) return d->isEmpty(); - return d->sectionIsPresent == url.d->sectionIsPresent && + + // Compare which sections are present, but ignore Host + // which is set by parsing but not by construction, when empty. + const int mask = QUrlPrivate::FullUrl & ~QUrlPrivate::Host; + return (d->sectionIsPresent & mask) == (url.d->sectionIsPresent & mask) && d->scheme == url.d->scheme && d->userName == url.d->userName && d->password == url.d->password && |