src/corelib/io/qurl.cpp
changeset 30 5dc02b23752f
parent 29 b72c6db6890b
child 37 758a864f9613
--- a/src/corelib/io/qurl.cpp	Wed Jun 23 19:07:03 2010 +0300
+++ b/src/corelib/io/qurl.cpp	Tue Jul 06 15:10:48 2010 +0300
@@ -167,6 +167,13 @@
     regardless of the Qt::FormattingOptions used.
 */
 
+/*!
+ \fn uint qHash(const QUrl &url)
+ \since 4.7
+ \relates QUrl
+
+ Computes a hash key from the normalized version of \a url.
+ */
 #include "qplatformdefs.h"
 #include "qurl.h"
 #include "private/qunicodetables_p.h"
@@ -3485,8 +3492,12 @@
 void QUrlPrivate::setAuthority(const QString &auth)
 {
     isHostValid = true;
-    if (auth.isEmpty())
+    if (auth.isEmpty()) {
+        setUserInfo(QString());
+        host.clear();
+        port = -1;
         return;
+    }
 
     // find the port section of the authority by searching from the
     // end towards the beginning for numbers until a ':' is reached.
@@ -5557,6 +5568,12 @@
     removeDotsFromPath(&t.d->encodedPath);
     t.d->path.clear();
 
+#if defined(QURL_DEBUG)
+    qDebug("QUrl(\"%s\").resolved(\"%s\") = \"%s\"",
+           toEncoded().constData(),
+           relative.toEncoded().constData(),
+           t.toEncoded().constData());
+#endif
     return t;
 }
 
@@ -6378,7 +6395,7 @@
         return QUrl::fromLocalFile(trimmedString);
 
     QUrl url = QUrl::fromEncoded(trimmedString.toUtf8(), QUrl::TolerantMode);
-    QUrl urlPrepended = QUrl::fromEncoded((QLatin1String("http://") + trimmedString).toUtf8(), QUrl::TolerantMode);
+    QUrl urlPrepended = QUrl::fromEncoded("http://" + trimmedString.toUtf8(), QUrl::TolerantMode);
 
     // Check the most common case of a valid url with scheme and host
     // We check if the port would be valid by adding the scheme to handle the case host:port