summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurl.cpp
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2013-07-19 12:03:25 -0700
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-08-04 04:48:35 +0200
commitc615dcc44168d8e8e1e2134d69c3bd9607c603ea (patch)
treeb242307e5f7485443117b74df786fb4e4c6d4711 /src/corelib/io/qurl.cpp
parent7b964c77fa15fa3fbf18538ebcdf6b09ffbbbd0e (diff)
QUrl: do not decode "#" in fragments
For some time, we've assumed that the URL specification had a mistake in that it didn't allow the "#" character to appear decoded in the fragment. We've gotten away with it so far. However, turns out that the CoreFoundation NSURL class doesn't like it. So we have to be stricter. [ChangeLog][Important Behavior Changes][QUrl and QUrlQuery] QUrl no longer decodes %23 found in the fragment to "#" in the output of toString(QUrl::FullyEncoded) or toEncoded() Task-number: QTBUG-31945 Change-Id: If5e0fb37bae84710986c9ca89bd69ec98437cd63 Reviewed-by: David Faure (KDE) <faure@kde.org>
Diffstat (limited to 'src/corelib/io/qurl.cpp')
-rw-r--r--src/corelib/io/qurl.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/corelib/io/qurl.cpp b/src/corelib/io/qurl.cpp
index 10550a5b62..9607f14853 100644
--- a/src/corelib/io/qurl.cpp
+++ b/src/corelib/io/qurl.cpp
@@ -632,7 +632,6 @@ inline void QUrlPrivate::setError(ErrorCode errorCode, const QString &source, in
// here are the gen-delims we can unambiguously transform when the field is
// taken in isolation:
// - fragment: none, since it's the last
-// Deviation: the spec says "#" <-> %23 is unambiguous, but we treat it as if were
// - query: "#" is unambiguous
// - path: "#" and "?" are unambiguous
// - host: completely special but never ambiguous, see setHost() below.
@@ -747,7 +746,7 @@ static const ushort userNameInUrl[] = {
static const ushort * const passwordInUrl = userNameInUrl + 1;
static const ushort * const pathInUrl = userNameInUrl + 5;
static const ushort * const queryInUrl = userNameInUrl + 6;
-static const ushort * const fragmentInUrl = 0;
+static const ushort * const fragmentInUrl = userNameInUrl + 6;
static inline void parseDecodedComponent(QString &data)
{
@@ -879,7 +878,8 @@ inline void QUrlPrivate::appendPath(QString &appendTo, QUrl::FormattingOptions o
inline void QUrlPrivate::appendFragment(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const
{
appendToUser(appendTo, fragment, options,
- appendingTo == FullUrl || options & QUrl::EncodeDelimiters ? fragmentInUrl : fragmentInIsolation);
+ options & QUrl::EncodeDelimiters ? fragmentInUrl :
+ appendingTo == FullUrl ? 0 : fragmentInIsolation);
}
inline void QUrlPrivate::appendQuery(QString &appendTo, QUrl::FormattingOptions options, Section appendingTo) const