Skip to content

Commit

Permalink
fix(dns): detect disabled IPv6 support in DNS pinning
Browse files Browse the repository at this point in the history
Signed-off-by: Benjamin Gaussorgues <[email protected]>
  • Loading branch information
Altahrim committed Mar 26, 2024
1 parent 47ac907 commit 559ff57
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion lib/private/Http/Client/DnsPinMiddleware.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,10 @@ private function dnsResolve(string $target, int $recursionCount) : array {
$soaDnsEntry = $this->soaRecord($target);
$dnsNegativeTtl = $soaDnsEntry['minimum-ttl'] ?? null;

$dnsTypes = [DNS_A, DNS_AAAA, DNS_CNAME];
// Detect IPv6 support without dependency to php-sockets
$dnsTypes = inet_pton('::1') === false
? [DNS_A, DNS_CNAME]
: [DNS_A, DNS_AAAA, DNS_CNAME];
foreach ($dnsTypes as $dnsType) {
if ($this->negativeDnsCache->isNegativeCached($target, $dnsType)) {
continue;
Expand Down

0 comments on commit 559ff57

Please sign in to comment.