Skip to content

chg: [rdap] look hostnames up at their registered domain - #937

Merged
adulau merged 1 commit into
mainfrom
rdap-registered-domain
Oct 15, 2026
Merged

adulau merged 1 commit into
mainfrom
rdap-registered-domain

Conversation

@mokaddem

Copy link
Copy Markdown
Contributor

Registries only hold registered domains, so asking rdap.org for a hostname, a subdomain or the host of a URL returned no record. The module now finds the registered domain with the ICANN section of the Public Suffix List and asks for it once; a public suffix is asked as given. The private section is skipped on purpose: duckdns.org is registered under .org, and its registry answers for duckdns.org, not foo.duckdns.org.

The whois object's domain is the lowercased name that was asked, not RDAP's ldhName, and a comment says when it is the registered domain of the input host. The host is not added as a second domain, so the record does not read as the subdomain's own registration. A 404 or 400 on a domain lookup is reported as no record found, naming both names when they differ. Input is trimmed, lowercased and stripped of a trailing dot. IP lookups are unchanged.

Changes

  • The input is trimmed, lowercased and stripped of a trailing dot.
  • The module finds the registered domain with the ICANN section of the Public Suffix List and asks rdap.org for it, once per run:
    • login.example.com → example.com
    • news.bbc.co.uk → bbc.co.uk
    • foo.duckdns.org → duckdns.org
  • A public suffix (e.g. co.uk) is still asked for as given.
  • The whois object's domain is the lowercased name that was queried, not RDAP's ldhName. When that differs from the input host, a comment says so. The host is deliberately not added as a second domain, so the record doesn't read as the subdomain's own registration.
  • A 404 or 400 on a domain lookup returns "No RDAP record found for …", naming both names when they differ. Some registries answer 400 rather than 404 for an unknown name.
  • IP lookups are unchanged. moduleinfo version goes to 2.

Testing

  • 10 new mocked tests; each one checks that exactly one request is made. The existing URL test now expects the registered domain.
  • Checked live against rdap.org:
    • www.example.com → example.com (1995-08-14)
    • mail.google.com → google.com (1997-09-15)
    • news.bbc.co.uk → bbc.co.uk (1994-12-13)
    • foo.duckdns.org → duckdns.org (2013-04-12)
    • x.github.io and denic.de return the "no record" error

Registries only hold registered domains, so asking rdap.org for a
hostname, a subdomain or the host of a URL returned no record. The
module now finds the registered domain with the ICANN section of the
Public Suffix List and asks for it once; a public suffix is asked as
given. The private section is skipped on purpose: duckdns.org is
registered under .org, and its registry answers for duckdns.org, not
foo.duckdns.org.

The whois object's domain is the lowercased name that was asked, not
RDAP's ldhName, and a comment says when it is the registered domain of
the input host. The host is not added as a second domain, so the record
does not read as the subdomain's own registration. A 404 or 400 on a
domain lookup is reported as no record found, naming both names when
they differ. Input is trimmed, lowercased and stripped of a trailing
dot. IP lookups are unchanged.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
@adulau
adulau merged commit 9b82b04 into main Oct 15, 2026
7 checks passed
@adulau

adulau commented Oct 15, 2026

Copy link
Copy Markdown
Member

Good one!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants