fix(webconnectivity): allow measuring https://1.1.1.1 (#241)

* fix(webconnectivity): allow measuring https://1.1.1.1

There were two issues preventing us from doing so:

1. in netx, the address resolver was too later in the resolver
chain. Therefore, its result wasn't added to the events.

2. when building the DNSCache (in httpget.go), we didn't consider
the case where the input is an address. We need to treat this
case specially to make sure there is no DNSCache.

See https://github.com/ooni/probe/issues/1376.

* fix: add unit tests for code making the dnscache

* fix(netx): make sure all tests pass

* chore: bump webconnectivity version
This commit is contained in:
Simone Basso 2021-03-08 12:05:43 +01:00 committed by GitHub
commit 2ef5fb503a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 80 additions and 45 deletions

View file

@ -25,3 +25,20 @@ func TestHTTPGet(t *testing.T) {
t.Fatal(*r.Failure)
}
}
func TestHTTPGetMakeDNSCache(t *testing.T) {
// test for input being an IP
out := webconnectivity.HTTPGetMakeDNSCache(
"1.1.1.1", "1.1.1.1",
)
if out != "" {
t.Fatal("expected empty output here")
}
// test for input being a domain
out = webconnectivity.HTTPGetMakeDNSCache(
"dns.google", "8.8.8.8 8.8.4.4",
)
if out != "dns.google 8.8.8.8 8.8.4.4" {
t.Fatal("expected ordinary output here")
}
}