Overhaul a little the QUrl error reporting.
authorThiago Macieira <thiago.macieira@intel.com>
Thu, 20 Sep 2012 15:22:01 +0000 (17:22 +0200)
committerThe Qt Project <gerrit-noreply@qt-project.org>
Tue, 2 Oct 2012 20:34:42 +0000 (22:34 +0200)
commitf89fd779fc4431f667d937ea502fd930e6425079
tree2668e07f1471c9c03b6e9f4348767003ed1cffaf
parent4f52a9509995b1f5c834354ff6d02fa9b4f4396d
Overhaul a little the QUrl error reporting.

Keep the original QString that triggered the parsing error, instead of
just one QChar. This provides more powerful error messages, like:

 Invalid IPv6 address; source was "http://[:::]";  scheme = "http", host = ""
 (QUrl cannot keep invalid hostnames)

 Invalid port or port number out of range; source was "http://example.com:abc";  scheme = "http", host = "example.com"
 (QUrl cannot keep a non-numeric port number)

 Invalid path (character '%' not permitted); source was "foo:/path%?";  scheme = "foo", path = "/path%25%1F"
 (the tolerant parser runs first, so the faulty component is fixed)

This stores the error state in a special structure which is not
allocated under normal conditions, keeping the memory consumption
down. On 32-bit systems, QUrlPrivate does not increase in size; on
64-bit systems, it grows by 8 bytes.

Change-Id: I93d798d43401dfeb9fca7b6eed7ea758da10136b
Reviewed-by: David Faure <faure@kde.org>
src/corelib/io/qurl.cpp
tests/auto/corelib/io/qurl/tst_qurl.cpp