Skip to content

Commit 985a574

Browse files
committed
net: fix LookupCNAME on Plan 9
In CL 34650, LookupCNAME was changed so it always returns the canonical DNS host, even when there is no CNAME record. Consequently, TestLookupCNAME was failing on Plan 9, because www.google.com doesn't have a CNAME record. We changed the implementation of lookupCNAME on Plan 9, so it returns the canonical DNS host after a CNAME lookup failure. Fixes #18391. Change-Id: I59f361bfb2c9de3953e998e8ac58c054979210bd Reviewed-on: https://go-review.googlesource.com/34633 Reviewed-by: Brad Fitzpatrick <[email protected]> Run-TryBot: David du Colombier <[email protected]> TryBot-Result: Gobot Gobot <[email protected]>
1 parent 6e87f88 commit 985a574

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/net/lookup_plan9.go

+4
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,10 @@ func (*Resolver) lookupPort(ctx context.Context, network, service string) (port
198198
func (*Resolver) lookupCNAME(ctx context.Context, name string) (cname string, err error) {
199199
lines, err := queryDNS(ctx, name, "cname")
200200
if err != nil {
201+
if stringsHasSuffix(err.Error(), "dns failure") {
202+
cname = name + "."
203+
err = nil
204+
}
201205
return
202206
}
203207
if len(lines) > 0 {

0 commit comments

Comments
 (0)