fix(wcth): match legacy TH w/ empty DNS reply (#546)
See https://github.com/ooni/probe/issues/1707#issuecomment-944322725
This commit is contained in:
parent
2d1666b88b
commit
2fa87f0e00
|
@ -51,8 +51,13 @@ func dnsMapFailure(failure *string) *string {
|
||||||
// already checking for this specific error string.
|
// already checking for this specific error string.
|
||||||
s := webconnectivity.DNSNameError
|
s := webconnectivity.DNSNameError
|
||||||
return &s
|
return &s
|
||||||
case netxlite.FailureDNSNoAnswer,
|
case netxlite.FailureDNSNoAnswer:
|
||||||
netxlite.FailureDNSNonRecoverableFailure,
|
// In this case the legacy TH would produce an empty
|
||||||
|
// reply that is not attached to any error.
|
||||||
|
//
|
||||||
|
// See https://github.com/ooni/probe/issues/1707#issuecomment-944322725
|
||||||
|
return nil
|
||||||
|
case netxlite.FailureDNSNonRecoverableFailure,
|
||||||
netxlite.FailureDNSRefusedError,
|
netxlite.FailureDNSRefusedError,
|
||||||
netxlite.FailureDNSServerMisbehaving,
|
netxlite.FailureDNSServerMisbehaving,
|
||||||
netxlite.FailureDNSTemporaryFailure:
|
netxlite.FailureDNSTemporaryFailure:
|
||||||
|
|
|
@ -31,7 +31,7 @@ func Test_dnsMapFailure(t *testing.T) {
|
||||||
}, {
|
}, {
|
||||||
name: "no answer",
|
name: "no answer",
|
||||||
failure: stringPointerForString(netxlite.FailureDNSNoAnswer),
|
failure: stringPointerForString(netxlite.FailureDNSNoAnswer),
|
||||||
want: stringPointerForString("dns_server_failure"),
|
want: nil,
|
||||||
}, {
|
}, {
|
||||||
name: "non recoverable failure",
|
name: "non recoverable failure",
|
||||||
failure: stringPointerForString(netxlite.FailureDNSNonRecoverableFailure),
|
failure: stringPointerForString(netxlite.FailureDNSNonRecoverableFailure),
|
||||||
|
|
|
@ -64,6 +64,9 @@ func (r *SerialResolver) LookupHost(ctx context.Context, hostname string) ([]str
|
||||||
addrsA, errA := r.lookupHostWithRetry(ctx, hostname, dns.TypeA)
|
addrsA, errA := r.lookupHostWithRetry(ctx, hostname, dns.TypeA)
|
||||||
addrsAAAA, errAAAA := r.lookupHostWithRetry(ctx, hostname, dns.TypeAAAA)
|
addrsAAAA, errAAAA := r.lookupHostWithRetry(ctx, hostname, dns.TypeAAAA)
|
||||||
if errA != nil && errAAAA != nil {
|
if errA != nil && errAAAA != nil {
|
||||||
|
// Note: we choose to return the errA because we assume that
|
||||||
|
// it's the more meaningful one: the errAAAA may just be telling
|
||||||
|
// us that there is no AAAA record for the website.
|
||||||
return nil, errA
|
return nil, errA
|
||||||
}
|
}
|
||||||
addrs = append(addrs, addrsA...)
|
addrs = append(addrs, addrsA...)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user