summaryrefslogtreecommitdiffstats
path: root/tests/auto/corelib/io
Commit message (Collapse)AuthorAgeFilesLines
* Fix QFile::permissions for long filenamesShane Kearns2012-05-161-7/+59
| | | | | | | | | | When qt_ntfs_permission_lookup is used, QFile::permissions failed for files with long filenames. Also created a test case for this API, which revealed another bug. Task-number: QTBUG-25629 Change-Id: I73b7676a9d059c0e782b3f701b2e6bbc92f671ed Reviewed-by: Prasanth Ullattil <prasanth.ullattil@nokia.com>
* Fix cases where functions are called with a drive and no slashAndy Shaw2012-05-161-1/+25
| | | | | | | | | | | | | | | When a file is specified on a path that includes a drive letter followed by a colon but no slash then it didn't always account for the fact that this refers to the current path on that drive. This fixes the problems in completeBaseName(), baseName() and path(). Tests are also added for these three cases and some others too. Task-number: QTBUG-25353 Change-Id: I47a197c6af066f532442ad269be57597ec61303a Reviewed-by: Irfan Omair <irfan.omair@gmail.com> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* Remove capitalization when specifying include-libraries.kb2012-05-142-2/+2
| | | | | | | | | | | | | MinGW installations on case-sensitive filesystems expect lowercase names of include-libraries and (usually) include files. When crosscompiling on Debian 6 (targeting MS Windows) linking fails because mingw is looking for non-existent include-libraries. Using lowercase names solves this. Change-Id: Id3454f4ed8ba42b6ea93d65d9c0ce567db6712df Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* QUrl: using sectionIsPresent in operator== broke for local files.David Faure2012-05-141-0/+4
| | | | | | | | | QUrl::fromLocalFile("/foo") doesn't set Host, but QUrl("file:///foo") does (to remember that it saw a Host section, even if empty, which is useful for urls like "remote://"). So ignore the Host flag in operator==. Change-Id: I4322b4a75420c4e42766c0d65c1b121f28028a76 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: a url with a fragment or query, and one without, are different.David Faure2012-05-141-0/+2
| | | | | | | | | Fix operator== and operator< so that a URL with an empty fragment or query, is not treated as equal to a URL without any fragment or query. This restores the Qt4 behavior on this particular issue. Change-Id: Ie989f37353fb13c791b1d558d638d2e8a5b5d1b8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Restore QUrl::setEncodedQuery(QByteArray()) to the Qt4 behavior.David Faure2012-05-131-2/+9
| | | | | | | | | | Null bytearray means no query, and QString::fromLatin1(QByteArray()) doesn't give a null string, but an empty string. Same for setEncodedFragment(QByteArray()). Change-Id: I992e9253e35941d66886456872ea06aa2ae92450 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix a crash when parsing a URL with username and port, but no passwordThiago Macieira2012-05-101-0/+10
| | | | | | | | | | This was crashing because the ':' was found past the end of the username, causing the recoder to run from position 22 to 11, via the long way around the memory. Change-Id: Ic1ae596f34f7db857fb4210294974fb5a6adf691 Reviewed-by: Alexis Menard <alexis.menard@openbossa.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix qDecodeDataUrl for already percentage encoded content.Alexis Menard2012-05-093-0/+98
| | | | | | | | | | | If the url we pass as parameter already have percentage encoded data, we don't want to decode it and call fromPercentEncoding. The test coverage is not complete for qdataurl.cpp file but it is better than previously and it will also protect us from future regressions. Change-Id: I79f709f44bed1b7f274a3de639c7e291fa91a193 Reviewed-by: Thiago Macieira Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix QUrl::StripTrailingSlash for the case of no path at all.David Faure2012-05-091-0/+1
| | | | | Change-Id: I1fd0fe4b9b67996732c85c1792415e371e865595 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Slightly improve the query encode/decode test in QUrlThiago Macieira2012-05-041-6/+7
| | | | | | | | Show that nothing is changed either way, regardless of the encoding flags used. Change-Id: I31fba5f87eae777d4b708ab789b32169004bcbcc Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Fix QUrl::toString(StripTrailingSlash) to not turn file:/// into file:David Faure2012-05-041-10/+18
| | | | | | | | It should only strip one slash (as the name indicates), and not if the path is just "/". Change-Id: I133a81977241de77a49d1d1559143d30e0bd52f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Change remaining uses of {to,from}Ascii to {to,from}Latin1 [QtCore]Thiago Macieira2012-05-042-3/+3
| | | | | | | | | | | This operation should be a no-op anyway, since at this point in time, the fromAscii and toAscii functions simply call their fromLatin1 and toLatin1 counterparts. Task-number: QTBUG-21872 Change-Id: I38f97ad379deafebef02c75d611343ca15640c8a Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@nokia.com>
* Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-05-031-14/+14
|\ | | | | | | | | | | | | | | | | | | | | | | Conflicts: src/corelib/global/qglobal.cpp src/corelib/global/qlogging.cpp src/gui/kernel/qguiapplication.h src/gui/kernel/qwindow.cpp src/gui/kernel/qwindow.h tests/auto/corelib/kernel/qvariant/tst_qvariant.cpp Change-Id: I62a8805577a7940d4d36bed985eb3e7019d22f2e
| * Logging: Change arguments of message handler to avoid conversionsKai Koehne2012-04-201-14/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Introduce a new QtMessageHandler that takes QString instead of char *: This avoids converting to local8bit , only to convert it back to utf16 for Windows. The old QMessageHandler is kept for a transition period, but will be removed before Qt 5.0. Also fix qEmergencyOut (that is called in OOM situations) to not rely on the default message handler. Change-Id: Iee0ce5838f97175c98788b847964273dd22d4a37 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* | Don't use obsolete qVariantValue, qVariantCanConvert, etc.Debao Zhang2012-05-022-10/+10
| | | | | | | | | | | | | | | | | | | | qVariantValue and qVariantCanConvert are Compatibility members, while in Qt4.8 they are marked as Qt 3 Support Members. qVariantFromValue and qVariantSetValue are Obsolete members. Change-Id: Ie8505cad1e0950e40c6f6710fde9f6fb2ac670fd Reviewed-by: Friedemann Kleint <Friedemann.Kleint@nokia.com>
* | Wrap all Latin 1 strings with QString::fromLatin1 or QLatin1StringsThiago Macieira2012-04-271-23/+23
| | | | | | | | | | Change-Id: I1a1891b9126a2546c1872ec25aba9581cc84bb2f Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Ensure that QUrl::{to,from}LocalPath encode/decode properlyThiago Macieira2012-04-261-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unlike path(), toLocalFile() isn't reporting a URL component, so it should decode the percent-encoded characters fully. This extra decoding pass is meant to catch %00 to %1F, %7F and %25 (the percent sign itself). It also catches %80 to %FF, which aren't decoded because they don't form UTF-8 sequences. That means QUrl::toLocalFile() has undefined behaviour if the path contained non-UTF8 sequences. Task-number: QTBUG-25459 Change-Id: Iab5a0ba6afcfc4510e297984f2ffc208cedd752b Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* | Revert QUrl::isRelative to its Qt 4 behaviourThiago Macieira2012-04-251-1/+1
| | | | | | | | | | | | | | | | | | Instead of trying to return whether the URL is relative to something undefined, let's instead follow what the documentation was saying all along and what the RFC says about "Relative References". Change-Id: I32722321a6b36c6e3480669ad769390e4c6f7d1c Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* | Mark known test failures in Windows developer build.Jason McDonald2012-04-251-0/+3
| | | | | | | | | | | | | | | | | | Previously, the CI system has not been testing on Windows with the -developer-build configure flag. Mark known failures for this configuration so that tests can be run in enforcing mode. Change-Id: I5fbbbe09a7b400d626107c66dcbd5c5469a45b20 Reviewed-by: Sergio Ahumada <sergio.ahumada@nokia.com>
* | Ensure that QUrl::toLocalFile returns decoded pathsThiago Macieira2012-04-241-0/+1
| | | | | | | | | | | | | | | | | | | | | | QUrl::path() already decodes almost everything, but let's pass the formatting flag to be sure. Note: decoding of control characters from U+0001 to U+001F is not implemented. Non-UTF8 sequences are also not representable. Change-Id: I9a0ae2282ec3d48cc0e70e5b2d3824fb120709ed Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* | Don't strip the leading slash of letter+colon paths on UnixThiago Macieira2012-04-241-0/+4
| | | | | | | | | | | | | | | | | | It's perfectly valid to have a path of /c:/a.txt on Unix, so don't strip the leading slash unless we're on Windows. Task-number: QTBUG-20322 Change-Id: I721bd0a65b41048bc735d4eaa0d536174164fe64 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
* | Really marked tst_QProcess as insignificant on Windows.Rohan McGovern2012-04-191-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This test hangs ~2.6% of the time in CI. The previous commit which attempted to mark this test as insignificant did not work due to this .pro file doing a load(testcase) prior to the line which set CONFIG += insignificant_test. testcase.prf must be loaded _after_ insignificant_test is set. Task-number: QTBUG-25342 Change-Id: I20470337fda8235e2fd0b6e8d5f564c8c57d167e Reviewed-by: Kalle Lehtonen <kalle.ju.lehtonen@nokia.com>
* | Merge remote-tracking branch 'origin/api_changes'Lars Knoll2012-04-1711-973/+2922
|\| | | | | | | Change-Id: I964b0a6f5c38351fdfafb8a2a128a349ff8c89d1
| * Merge remote-tracking branch 'origin/master' into api_changesLars Knoll2012-04-164-7/+5
| |\ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/corelib/io/qurl.cpp src/gui/kernel/qwindow.cpp src/tools/moc/generator.cpp src/widgets/kernel/qwidget_qpa.cpp src/widgets/styles/qstyle.h src/widgets/widgets/qtabbar.cpp tests/auto/corelib/codecs/utf8/tst_utf8.cpp Change-Id: Ia457228d6f684ec8184e13e8fcc9d25857b1751e
| * | Ensure proper handling of empty-but-present URL componentsThiago Macieira2012-04-121-7/+27
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The new QUrl is able to distinguish a URL component that is empty from one that is absent. The previous one already had that capability for the port, fragment and query, and the new one extends that to the username, password and path. The path did not need this handling because its delimiter from the authority it part of the path. For example, a URL with no username is one where it's set to QString() (null). A URL like "http://:kde@kde.org" is understood as an empty-but-present username, for which toString(RemovePassword) will return "http://@kde.org", keeping the empty-but-present username. Change-Id: I2d97a7656f3f1099e3cf400b199e68e4c480d924 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Readd a bunch of tests that had got removed in the QUrl portingThiago Macieira2012-04-111-6/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Most of the tests were removed while QUrl::toEncoded or fromEncoded were deprecated in the development process. Since they aren't deprecated in the end, bring them back. Change-Id: Ibdb6cd3c4b83869150724a8e327a03a2cd22580d Reviewed-by: Robin Burchell <robin+qt@viroteck.net> Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Change the component formatting enum values so the default is zeroThiago Macieira2012-04-113-28/+33
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | By having the default value equal to zero, we follow the principle of least surprise. For example, if we had url.path() and we refactored to url.path(QUrl::DecodeSpaces) Then instead of ensuring spaces are decoded, we make spaces the only thing encoded (unicode, delimiters and reserved characters are encoded). Besides, modifying the default can only be used to encode something that wasn't encoded previously, so having the enums as Encode makes more sense. As a side-effect, toEncoded() does not support any extra encoding options. Change-Id: I2624ec446e65c2d979e9ca2f81bd3db22b00bb13 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Allow {} to remain decoded in URLs in the path and queryThiago Macieira2012-04-111-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows things like http://example.com/{1234-5678}?id={abcd-ef01}. But do not allow it in other parts of the URL. I could allow it in the fragment, but in the username and password it would be too ugly. In order to do that, make DecodeReserved use two bits and have PrettyDecoded set only one of them. That way, toString(PrettyDecoded) can be distinguished from toString(PrettyDecoded | DecodeReserved), just as path(PrettyDecoded) can be distinguished from path(PrettyDecoded & ~DecodeDelimiters). Also, take the opportunity to avoid decoding the reserved characters in the query. Keep them encoded as they should be. Change-Id: I1604a0c8015c6b03dc2fbf49ea9d1dbed96fc186 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Introduce QUrl::DecodeReserved and reorder the enumsThiago Macieira2012-04-111-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | DecodeReserved applies to all characters between 0x21 and 0x7E that aren't unreserved, a delimiter, or the percent sign itself. Change-Id: Ie64bddb6b814dfa3bb8380e3aa24de1bb3645a65 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Merge QUrl::DecodeAllDelimiters and QUrl::DecodeUnambiguousDelimitersThiago Macieira2012-04-112-7/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There's little value in having the DecodeUnambiguousDelimiters option since neither QUrl nor QUrlQuery can return values that are ambiguous in that particular context, ever. This option could be used to encode a character if, when placed in a URL, it would need to be encoded. Such cases are hash (#) or question marks (?) in the path component, or slashes (/) and at signs (@) in the userinfo. However, we don't need two enums for that, since there are no other characters that can appear in either form. Still, leave two bits for this enum. In the future, if we want to split the gen-delims from the sub-delims, we are able to. Change-Id: If5416b524680eb67dd4abbe7d072ca0ef7218506 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Add a big test for QUrl encoding principlesThiago Macieira2012-04-111-0/+233
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This tests how QUrl encodes and decodes certain characters and leaves some other ones alone. It also tests that the output of toString() (in whichever encoding was being tested) is also parsed again to be exactly the same as the previously decoded form. Change-Id: Ie358d001f8b903409db61db48bde1ea679241a60 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Fix the handling of ambiguous delimiters in the query part of a URLThiago Macieira2012-04-111-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is the same fix as the previous commit did for the other components of the URL. But we're also changing how we handle the "[]" characters in a query: previously the handling was like for other sub-delims; now, they're always decoded, assuming that the RFC had a mistake and they were meant to be decoded. Change-Id: If4b1c3df8f341cb114f2cc4860de22f8bf0be743 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Make QUrl handle ambiguous delimiters correctlyThiago Macieira2012-04-111-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Refactor the way that QUrl stores and returns the components of the URL so that ambiguous delimiters (gen-delims that could change the meaning of the parsing) are interpreted correctly. Previously, QUrl called "unambiguous" the form found in a full URL, even though each item in isolation could have more characters decoded. Now, instead, store only the fully decoded form. To recreate the compound forms (the full URL, as well as the user info and the authority), we need to do more processing. This commit applies to the user name, password, path and fragment only. The scheme, host and port do not need this work because they are special; the query is handled separately. Change-Id: I5907ba9b8fe048fff23c128be95668c22820663a Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Deprecate qMemCopy/qMemSet in favour of their stdlib equivilents.Robin Burchell2012-04-111-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Just like qMalloc/qRealloc/qFree, there is absolutely no reason to wrap these functions just to avoid an include, except to pay for it with worse runtime performance. On OS X, on byte sizes from 50 up to 1000, calling memset directly is 28-15% faster(!) than adding an additional call to qMemSet. The advantage on sizes above that is unmeasurable. For qMemCopy, the benefits are a little more modest: 16-7%. Change-Id: I98aa92bb765aea0448e3f20af42a039b369af0b3 Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: John Brooks <john.brooks@dereferenced.net> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | Adjust a double leading slash in the path for FTP to /%2FThiago Macieira2012-04-101-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Some FTP implementations (currently not including QNAM) strip the first slash off the path in an FTP URL so that the path in the URL is relative to the login path (the user's home directory). To reach the root directory, another slash is necessary, hence the double slash. In anticipation of future URL normalisation, which Qt 4 could do, "//" could be rendered to "/", so this extra slash should be "%2F". This operation is done only in QUrl::fromUserInput. Change-Id: If9619ef6b546a3f4026cb26b74a7a5a865123609 Reviewed-by: Shane Kearns <shane.kearns@accenture.com>
| * | Merge remote-tracking branch 'origin/master' into api_changesOswald Buddenhagen2012-04-104-22/+13
| |\ \ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Conflicts: configure src/widgets/styles/qwindowsxpstyle.cpp tests/auto/gui/kernel/qwindow/qwindow.pro tests/auto/gui/kernel/qwindow/tst_qwindow.cpp Change-Id: I624b6d26abce9874c610c04954c1c45bc074bef3
| * | | Fix unittest for QStandardPaths::enableTestModeDavid Faure2012-04-051-5/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | It was confusing DataLocation and GenericDataLocation, and the same for CacheLocation and GenericCacheLocation. The test was passing in the api_changes branch because these were giving the same result (empty app name), but the QCoreApplication::applicationName fix in master makes these different, so the bug in the test showed up after merging. Change-Id: I80ef6883c96cfd02b8c277d9d686717028d396bb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
| * | | Revert to Qt4 behaviour that QUrl().isValid() == falseThiago Macieira2012-03-301-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are probably lots of places that rely on that behaviour, so go back to what it was. Change-Id: I4d1503a0ee105a50cdfaab52d9a5862a02c70757 Reviewed-by: David Faure <faure@kde.org>
| * | | Move the #include "tst_qurlinternal.moc" up to workaround a bugThiago Macieira2012-03-301-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I don't know if the bug is in moc or in qmake. But it bails out trying to parse the .cpp file after the tst_QUrlInternal::nameprep_testsuite_data function. If the #include is placed above, it works. If it's placed below, it doesn't. Change-Id: Ide554aa5aa3f1999e29604ba6d25ccdb09f6ef28 Reviewed-by: Marius Storm-Olsen <marius.storm-olsen@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
| * | | Fix the license headers for the files in the new-qurl branchThiago Macieira2012-03-301-0/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: I469fed8b72111905e31553d0c82e62ced4009d75 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
| * | | Fix QUrl operator== and operator<Thiago Macieira2012-03-301-0/+51
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Don't crash when either side is null but not both sides. Also make sure operator< is working properly and satisfies the basic conditions of a type (such as that if A < B, then !(B < A)). Change-Id: Idd9e9fc593e1a7781d9f4f2b13a1024b643926fd Reviewed-by: Giuseppe D'Angelo <dangelog@gmail.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Disallow spaces in URLs when parsing in StrictMode.Thiago Macieira2012-03-301-3/+1
| | | | | | | | | | | | | | | | | | | | Change-Id: I16de68aff2b9e84cc800734c5875aaee9a2ea565 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Reimplement the StrictMode URL parsingThiago Macieira2012-03-301-20/+55
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 <lars.knoll@nokia.com>
| * | | Re-introduce support for QUrl::errorString()Thiago Macieira2012-03-301-5/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Note that QUrl can only remember one error. If the URL contains more than one error condition, only the latest (in whichever parsing order URL decides to use) will be reported. I don't want too keep too much data in QUrlPrivate for validation, so let's use 4 bytes only. Change-Id: I2afbf80734d3633f41f779984ab76b3a5ba293a2 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | QUrl: Always lowercase the schemeThiago Macieira2012-03-301-6/+14
| | | | | | | | | | | | | | | | | | | | Change-Id: I8d467014d22384f1be15fdd746e20b1153a82a4e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Long live the new QUrl implementation.Thiago Macieira2012-03-301-164/+155
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Also say hello to QUrl's constructor and QUrl::toString being allowed again. QUrl operates now on UTF-16 encoded data, where a Unicode character matches its UTF-8 percent-encoded form (as per RFC 3987). The data may exist in different levels of encoding, but it is always in encoded form (a percent is always "%25"). For that reason, the previously dangerous methods are no longer dangerous. The QUrl parser is much more lenient now. Instead of blindly following the grammar from RFC 3986, we try to use common-sense. Hopefully, this will also mean the code is faster. It also operates on QStrings and, for the common case, will not perform any memory allocations it doesn't keep (i.e., it allocates only for the data that is stored in QUrlPrivate). The Null/Empty behaviour that fragments and queries had in Qt4 are now extended to the scheme, username, password and host parts. This means QUrl can remember the difference between "http://@example.com" and "http://example.com". Missing from this commit: - more unit tests, for the new functionality - the implementation of the StrictMode parser - errorString() support - normalisation Change-Id: I6d340b19c1a11b98a48145152513ffec58fb3fe3 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Forward the methods dealing with the break down of query to QUrlQueryThiago Macieira2012-03-302-101/+120
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Now that QUrlQuery exists, these methods are no longer necessary in QUrl itself. Manipulation of the items should be done using the new class. They are now implemented using a temporary QUrlQuery. This is hardly efficient but it works. Change-Id: I34820b3101424593d0715841a2057ac3f74d74f0 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Long live QUrlQueryThiago Macieira2012-03-302-0/+700
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This class is meant to replace the QUrl functionality that handled key-value pairs in the query part of an URL. We therefore split the URL parsing code from the code dealing with the pairs: QUrl now only needs to deal with one encoded string, without knowing what it is. Since it doesn't know how to decode the query, QUrl also becomes limited in what it can decode. Following the letter of the RFC, queries will not encode "gen-delims" nor "sub-delims" nor the plus sign (+), thus allowing the most common delimiters options to remain unchanged. QUrlQuery has some undefined behaviour when it comes to empty query keys. It may drop them or keep them; it may merge them, etc. Change-Id: Ia61096fe5060b486196ffb8532e7494eff58fec1 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Refactor the URL recoder a littleThiago Macieira2012-03-301-13/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Change it to operate on QChar pointers, which gains a little in performance. This also avoids unnecessary detaching in the QString source. In addition, make the output be appended to an existing QString. This will be useful later when we're reconstructing a URL from its components. Change-Id: I7e2f64028277637bd329af5f98001ace253a50c7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
| * | | Remove the tolerant parsing function and make the recoder tolerantThiago Macieira2012-03-301-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The reason for this change is that the strict parser made little sense to exist. What would the recoder do if it was passed an invalid string? I believe that the tolerant recoder is more efficient than the correcting code followed by the strict recoder. This makes the recoder more complex and probably a little less efficient, but it's better in the common case (tolerant that doesn't need fixes) and in the worst case (needs fixes). Change-Id: I68a0c9fda6765de05914cbd6ba7d3cea560a7cd6 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>