Skip to content

Commit

Permalink
add special case for the root zone
Browse files Browse the repository at this point in the history
  • Loading branch information
gbxyz committed Mar 15, 2024
1 parent 14f76c8 commit ed33c50
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion RDAP/Server.php
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,17 @@ private function logRequest(Request $request, int $status, IP $peer) : void {
* get the base URL for the given domain
*/
private function domain(string $domain) : ?string {
return $this->registries['dns']->search(fn($tld) => str_ends_with($domain, '.'.$tld));
return $this->registries['dns']->search(function($tld) use ($domain) {
if (empty($tld) && false == strpos($domain, '.')) {
// empty TLD indicates the root zone, and no dot indicates
// domain is a TLD
return true;

} else {
return str_ends_with($domain, '.'.$tld));

Check failure on line 228 in RDAP/Server.php

View workflow job for this annotation

GitHub Actions / Test

Syntax error, unexpected ')', expecting ';' on line 228

}
});
}

/**
Expand Down

0 comments on commit ed33c50

Please sign in to comment.