From 329ee8cedc78de5304a84e0b205b08f39e439411 Mon Sep 17 00:00:00 2001 From: Thiago Macieira Date: Wed, 28 Dec 2011 15:59:47 -0200 Subject: Reimplement the StrictMode URL parsing The strict mode check is now implemented after the tolerant parser has finished, and only if the tolerant parser has not found any errors. We catch the use of disallowed characters (control characters plus a few not permitted anywhere) and broken percent encodings. We do not catch the use of Unicode characters, as they are permitted in IRIs. In the tests, remove the old errorString test since it makes little sense. Change-Id: I8261a2ccad031ad68fc6377a206e59c9db89fb38 Reviewed-by: Lars Knoll --- src/corelib/io/qurl_p.h | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) (limited to 'src/corelib/io/qurl_p.h') diff --git a/src/corelib/io/qurl_p.h b/src/corelib/io/qurl_p.h index d9207bd809..fb54d74260 100644 --- a/src/corelib/io/qurl_p.h +++ b/src/corelib/io/qurl_p.h @@ -75,27 +75,37 @@ public: }; enum ErrorCode { - InvalidSchemeError = 0x000, + // the high byte of the error code matches the Section + InvalidSchemeError = Scheme << 8, SchemeEmptyError, - InvalidRegNameError = 0x800, + InvalidUserNameError = UserName << 8, + + InvalidPasswordError = Password << 8, + + InvalidRegNameError = Host << 8, InvalidIPv4AddressError, InvalidIPv6AddressError, InvalidIPvFutureError, HostMissingEndBracket, - InvalidPortError = 0x1000, + InvalidPortError = Port << 8, PortEmptyError, - PathContainsColonBeforeSlash = 0x2000, + InvalidPathError = Path << 8, + PathContainsColonBeforeSlash, + + InvalidQueryError = Query << 8, + + InvalidFragmentError = Fragment << 8, - NoError = 0xffff + NoError = 0 }; QUrlPrivate(); QUrlPrivate(const QUrlPrivate ©); - void parse(const QString &url); + void parse(const QString &url, QUrl::ParsingMode parsingMode); void clear(); // no QString scheme() const; -- cgit v1.2.3