summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorThiago Macieira <thiago.macieira@intel.com>2023-05-15 12:41:40 -0700
committerThiago Macieira <thiago.macieira@intel.com>2023-06-03 19:28:13 -0700
commit8b6bd8ed9970939d7ed86180579551350c111314 (patch)
tree267bb77e3191964e5d8b9d3d283e63e60541e59c /src
parent01dfcfcecf454a7bdc92980403796f1d3a49d8a4 (diff)
QDnsLookup: allow looking up the root domain
[ChangeLog][QtNetwork][QDnsLookup] It is now possible to look up the root DNS domain, by setting the name property to an empty string. This query is usually done while setting the query type to NS. Change-Id: I5f7f427ded124479baa6fffd175f688395941610 Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/network/kernel/qdnslookup.cpp8
1 files changed, 8 insertions, 0 deletions
diff --git a/src/network/kernel/qdnslookup.cpp b/src/network/kernel/qdnslookup.cpp
index 0356633735..c310c7e28e 100644
--- a/src/network/kernel/qdnslookup.cpp
+++ b/src/network/kernel/qdnslookup.cpp
@@ -343,6 +343,10 @@ bool QDnsLookup::isFinished() const
\property QDnsLookup::name
\brief the name to lookup.
+ If the name to look up is empty, QDnsLookup will attempt to resolve the
+ root domain of DNS. That query is usually performed with QDnsLookup::type
+ set to \l{QDnsLookup::Type}{NS}.
+
\note The name will be encoded using IDNA, which means it's unsuitable for
querying SRV records compatible with the DNS-SD specification.
*/
@@ -1050,6 +1054,10 @@ QDnsTextRecord &QDnsTextRecord::operator=(const QDnsTextRecord &other)
static QDnsLookupRunnable::EncodedLabel encodeLabel(const QString &label)
{
+ QDnsLookupRunnable::EncodedLabel::value_type rootDomain = u'.';
+ if (label.isEmpty())
+ return QDnsLookupRunnable::EncodedLabel(1, rootDomain);
+
QString encodedLabel = qt_ACE_do(label, ToAceOnly, ForbidLeadingDot);
#ifdef Q_OS_WIN
return encodedLabel;