summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2011-10-19 20:33:31 +0200
committerQt by Nokia <qt-info@nokia.com>2012-03-30 01:19:59 +0200
commitf40e934983f0b6685c25472e3cd2764cd177e1e7 (patch)
tree5888131acb6d57510523311623a7ea7f50782862 /src
parent2591545ee1ffa29236900d4cc08724c9f0dd7107 (diff)
QUrl: optimise setHost for the common case
Change-Id: Ib667557268ebf75cb796ddd716b337ca24b466ad Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
Diffstat (limited to 'src')
-rw-r--r--src/corelib/io/qurl.cpp11
1 files changed, 6 insertions, 5 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index b8ab9df052..36411a089e 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -1587,12 +1587,13 @@ QString QUrl::password(ComponentFormattingOptions options) const
void QUrl::setHost(const QString &host)
{
detach();
- if (host.contains(QLatin1Char(':')) || host.contains(QLatin1String("%3a"), Qt::CaseInsensitive))
+ if (d->setHost(host, 0, host.length())) {
+ if (host.isNull())
+ d->sectionIsPresent &= ~QUrlPrivate::Host;
+ } else {
+ // setHost failed, it might be IPv6 or IPvFuture in need of bracketing
d->setHost(QLatin1Char('[') + host + QLatin1Char(']'), 0, host.length() + 2);
- else
- d->setHost(host, 0, host.length());
- if (host.isNull())
- d->sectionIsPresent &= ~QUrlPrivate::Host;
+ }
}
/*!