diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp index b343a28e2f..3a1433ec39 100644 --- a/src/corelib/io/qurl.cpp +++ b/src/corelib/io/qurl.cpp @@ -1603,87 +1603,6 @@ inline void QUrlPrivate::validate() const } } } - -inline const QByteArray &QUrlPrivate::normalized() const -{ - if (QURL_HASFLAG(stateFlags, QUrlPrivate::Normalized)) - return encodedNormalized; - - QUrlPrivate *that = const_cast(this); - 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 - tmp.ensureEncodedParts(); - if (tmp.encodedUserName.contains('%')) - q_normalizePercentEncoding(&tmp.encodedUserName, userNameExcludeChars); - if (tmp.encodedPassword.contains('%')) - q_normalizePercentEncoding(&tmp.encodedPassword, passwordExcludeChars); - if (tmp.encodedFragment.contains('%')) - q_normalizePercentEncoding(&tmp.encodedFragment, fragmentExcludeChars); - - if (tmp.encodedPath.contains('%')) { - // the path is a bit special: - // the slashes shouldn't be encoded or decoded. - // They should remain exactly like they are right now - // - // treat the path as a slash-separated sequence of pchar - QByteArray result; - result.reserve(tmp.encodedPath.length()); - if (tmp.encodedPath.startsWith('/')) - result.append('/'); - - const char *data = tmp.encodedPath.constData(); - int lastSlash = 0; - int nextSlash; - do { - ++lastSlash; - nextSlash = tmp.encodedPath.indexOf('/', lastSlash); - int len; - if (nextSlash == -1) - len = tmp.encodedPath.length() - lastSlash; - else - len = nextSlash - lastSlash; - - if (memchr(data + lastSlash, '%', len)) { - // there's at least one percent before the next slash - QByteArray block = QByteArray(data + lastSlash, len); - q_normalizePercentEncoding(&block, pathExcludeChars); - result.append(block); - } else { - // no percents in this path segment, append wholesale - result.append(data + lastSlash, len); - } - - // append the slash too, if it's there - if (nextSlash != -1) - result.append('/'); - - lastSlash = nextSlash; - } while (lastSlash != -1); - - tmp.encodedPath = result; - } - - if (!tmp.scheme.isEmpty()) // relative test - removeDotsFromPath(&tmp.encodedPath); - - int qLen = tmp.query.length(); - for (int i = 0; i < qLen; i++) { - if (qLen - i > 2 && tmp.query.at(i) == '%') { - ++i; - tmp.query[i] = qToLower(tmp.query.at(i)); - ++i; - tmp.query[i] = qToLower(tmp.query.at(i)); - } - } - encodedNormalized = tmp.toEncoded(); - - return encodedNormalized; -} #endif /*!