fix(wcth): emit empty Addrs when input URL contains addr (#545)

Matches the behavior that the legacy TH implements in this
situation and reduces slightly the differences.

See https://github.com/ooni/probe/issues/1707#issuecomment-944143329
This commit is contained in:
Simone Basso 2021-10-15 12:00:20 +02:00 committed by GitHub
parent 730b00ff73
commit 2d1666b88b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -76,7 +76,12 @@ func Measure(ctx context.Context, config MeasureConfig, creq *CtrlRequest) (*Ctr
select {
case cresp.DNS = <-dnsch:
default:
// we land here when there's no domain name
// we need to emit a non-nil Addrs to match exactly
// the behavior of the legacy TH
cresp.DNS = CtrlDNSResult{
Failure: nil,
Addrs: []string{},
}
}
cresp.HTTPRequest = <-httpch
cresp.TCPConnect = make(map[string]CtrlTCPResult)