summaryrefslogtreecommitdiffstats
path: root/src/corelib/io/qurlidna.cpp
Commit message (Collapse)AuthorAgeFilesLines
* QUrl: fix IDN conversion when the ACE form is invalidThiago Macieira2017-04-251-9/+36
| | | | | | | | | | | | | | | | We guarded against the Unicode form being invalid and did not produce an encoded form. But we did not guard against proper Punycode sequences that decode to forms that had not passed the proper Nameprep stage. So check for that and, if it fails, just keep the label in the form we found it in (it's valid STD3 anyway). [ChangeLog][QtCore][QUrl] Fixed a bug that caused certain domain names that look like Internationalized Domain Names to become corrupt in decoded forms of QUrl, notably toString() and toDisplayString(). Task-number: QTBUG-60364 Change-Id: Iadfecb6f28984634979dfffd14b833142cca8d0d Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* QUrl: fix IDN whitelist checking when the TLD is in UnicodeThiago Macieira2017-04-241-2/+2
| | | | | | | | | | The whitelist is kept in ACE form, so if the TLD came in Unicode, we need to run ToASCII before we can check the whitelist. This is slightly inefficient because we'll run the same operation later in this domain. Change-Id: Iadfecb6f28984634979dfffd14b831f37b0f4818 Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Florian Bruhin <qt-project.org@the-compiler.org>
* Use QStringLiteral more judiciouslyAnton Kudryavtsev2016-07-081-1/+1
| | | | | | | | | | | | | | | Replace it with QL1S in QStringBuilder expressions and in overloaded functions. Replace patterns 'QString::number() + QStringLiteral' and 'QStringLiteral + QString::number()' with QString::asprintf. Saves some text size. Change-Id: Ib39b2332264dfc3df04e77f2c101b47a1030cef4 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add Intel copyright to files that Intel has had non-trivial contributionThiago Macieira2016-01-211-0/+1
| | | | | | | | | I wrote a script to help find the files, but I reviewed the contributions manually to be sure I wasn't claiming copyright for search & replace, adding Q_DECL_NOTHROW or adding "We mean it" headers. Change-Id: I7a9e11d7b64a4cc78e24ffff142b506368fc8842 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix some -Wcast-qual warningsThiago Macieira2015-09-221-1/+1
| | | | | | | | | | | This is happening in code I don't usually test (32-bit, non-ICU, etc.) KeccakF-1600-opt32.c:481:22: error: cast from type 'const unsigned char*' to type 'UINT32* {aka unsigned int*}' casts away qualifiers [-Werror=cast-qual] KeccakF-1600-opt32.c:217:62: note: in definition of macro 'extractLanes' Change-Id: I42e7ef1a481840699a8dffff140209823301a07a Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com> Reviewed-by: Richard J. Moore <rich@kde.org>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Merge remote-tracking branch 'origin/stable' into devFrederik Gladhorn2014-02-121-1/+1
|\ | | | | | | | | | | | | | | | | | | Conflicts: src/gui/image/qimage.cpp src/gui/text/qtextengine.cpp src/plugins/platforms/linuxfb/qlinuxfbscreen.cpp src/printsupport/kernel/qprintengine_win.cpp Change-Id: I09ce991a57f39bc7b1ad6978d0e0d858df0cd444
| * Small doc fix.Niels Weber2014-02-071-1/+1
| | | | | | | | | | Change-Id: If700cce1b39342ca2b1027e2c10711ea45c3dd9c Reviewed-by: Oliver Wolff <oliver.wolff@digia.com>
* | expand tabs and related whitespace fixes in *.{cpp,h,qdoc}Oswald Buddenhagen2014-01-131-1/+1
|/ | | | | | | | the diff -w for this commit is empty. Started-by: Thiago Macieira <thiago.macieira@intel.com> Change-Id: I77bb84e71c63ce75e0709e5b94bee18e3ce6ab9e Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix WinCE/MSVC2008 build errors related to std::lower_bound patches.Sérgio Martins2013-09-251-0/+5
| | | | | | | See QTBUG-33473 for more information about this compiler bug. Change-Id: I13b945350fdc38165c1515f0cdd75a53cf37cd6c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Remove qBinaryFind usages from QtCoreGiuseppe D'Angelo2013-09-231-4/+5
| | | | | | | | This is done per the mailing list discussion at http://www.mail-archive.com/development@qt-project.org/msg01603.html Change-Id: I6207982c08c92f3e01fb236d2e7546a1c9acd287 Reviewed-by: Olivier Goffart <ogoffart@woboq.com>
* Fix QUrl::topLevelDomain(QUrl::FullyDecoded)David Faure2013-07-061-2/+3
| | | | | | | | | qt_ACE_do(".co.uk") was returning an empty string because of the leading dot. Allow leading dots from topLevelDomain, but not from other calls. Change-Id: I757d9960708e205d30554cd2bbcf618c8624792b Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Revert "Fix QUrl::topLevelDomain(QUrl::FullyDecoded)"Thiago Macieira2013-07-021-2/+1
| | | | | | | | | | This reverts commit e3fa266623b08e837cb4ccc7fe59da243d03dd27 That commit applied a change at the wrong place in the code. Change-Id: I21e3045a3af14ad2f90c5fe338815c35a2d27ae6 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure (KDE) <faure@kde.org>
* Fix QUrl::topLevelDomain(QUrl::FullyDecoded)David Faure2013-07-011-1/+2
| | | | | | | | | qt_ACE_do(".co.uk") was returning an empty string because of the leading dot. This has always caused issues in KDE code too, where ACE normalization needs the dot removed, and re-added afterwards. Change-Id: Id9fcea0333cf55c14d755a86d4bf33a50f194429 Reviewed-by: Frederik Gladhorn <frederik.gladhorn@digia.com>
* Remove use of 'register' from Qt.Stephen Kelly2013-06-171-4/+4
| | | | | | | | | | It is deprecated and clang is starting to warn about it. Patch mostly generated by clang itself, with some careful grep and sed for the platform-specific parts. Change-Id: I8058e6db0f1b41b33a9e8f17a712739159982450 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl stringprep: fix handling of U+0080: it's prohibitedThiago Macieira2013-06-081-1/+1
| | | | | | | | Edge case: a > that should have been >=. Without it, we never ran the rest of the IDN nameprepping. Change-Id: I2276d660de3a70d0c561bb18816820d9a0f47e77 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QUrl stringprep: avoid recalculating the surrogates we already knowThiago Macieira2013-06-081-2/+2
| | | | | Change-Id: Icac4e81fff6f7f7fa4f46ec2a08105f8d3d2b403 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QUrl stringprep: fix handling of prohibited charactersThiago Macieira2013-06-081-11/+14
| | | | | | | | | | | | | | | | | | | | RFC 3454 says about prohibited characters (section 2, "Preparation Overview"): 3) Prohibit -- Check for any characters that are not allowed in the output. If any are found, return an error. This is described in section 5. In other words, we mustn't simply strip the output of prohibited characters. We must generate an error if they are present. We do that by clearing the data. We already had tests for prohibited output, but they were indistinguishable from being stripped. So instead add some extra characters so that we can tell whether the label was cleared. Change-Id: I2d95217c27be5e2d54deed0036cb009e3b7f4886 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QUrl stringprep: fix case folding from non-BMP to BMPThiago Macieira2013-06-081-1/+1
| | | | | | | | | | | | When uc > 0xffff (non-BMP character) and l == 1 (replacement is in the BMP), we must use QString::replace so the correct number of characters is replaced. There's one case testing this in tst_qurlinternal, but it is being obscured by another bug (false positive). Change-Id: I32388dd5bef32d4d6804aeeec4904bd5f563e9b9 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QUrl stringprep: recalculate the current position if the size changesThiago Macieira2013-06-081-1/+2
| | | | | | | | | | | | | If the case folding operation results in either expansion or reduction of the string, we need to adapt. Reduction happens most often when a non-BMP character is case-folded to a character in the BMP (example: mathematical signs at U+1D400-1D7FF). Expansion happens in the rare case of symbols containing words, like U+2121 ℡ (this is part of the unit test), and one common case: the German sharp S (ß) is expanded to "ss". Change-Id: I1bdbdc908b958a89bf30e4bb648d65dfdd9097f8 Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* QUrl: update top level domains that may contain non-ASCII charactersPeter Hartmann2013-03-021-7/+22
| | | | | | | | | Most notably, .com and .net now may contain non-ASCII characters. list has been generated from http://www.mozilla.org/projects/security/tld-idn-policy-list.html Change-Id: Idc3191dc782bc4173ccb19b4bc81f4f061ca7999 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Fix a couple of qdoc errorsLars Knoll2012-08-181-1/+1
| | | | | Change-Id: I79f689e08ed4a496052529af38fca72c3d4e04cb Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl::idnWhiteList(): add QList::reserve() callMarc Mutz2012-08-071-2/+4
| | | | | | | | Avoids reallocation. Change-Id: I3238574590463596a797d237b066ef60214392a7 Reviewed-by: David Faure <faure@kde.org> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QUrl: document that setIdnWhitelist isn't thread-safeMarc Mutz2012-07-301-0/+3
| | | | | | | This is a forward-port of 6b10fc91 from Qt 4. Change-Id: I58878bf24e4f1b50ebfd0457c37eef58696f4a4c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Add some missing includes.Stephen Kelly2012-05-031-0/+2
| | | | | | | | There is a #include <QStringList> line wrapped in QT_DEPRECATED_SINCE(5, 0). Change-Id: I766848dfcc3bd765c57626a3d70f492ac1219091 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Fix the license headers for the files in the new-qurl branchThiago Macieira2012-03-301-3/+3
| | | | | Change-Id: I469fed8b72111905e31553d0c82e62ced4009d75 Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Long live the new QUrl implementation.Thiago Macieira2012-03-301-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Move some of qurl.cpp into other files for ease of maintenanceThiago Macieira2012-03-301-0/+2592
The parsing code is now in qurlparser.cpp, whereas the IDNA related code is in qurlidna.cpp. Change-Id: I0b32c0bf0ee6c2f08dc3200c44af3c9d1504a3df Reviewed-by: Lars Knoll <lars.knoll@nokia.com>