From: David du Colombier <0intro@gmail.com> Date: Tue, 20 Dec 2016 21:33:06 +0000 (+0100) Subject: net: fix LookupCNAME on Plan 9 X-Git-Tag: go1.8rc1~70 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=985a574991207a74ab45ce76ecf54228734ddffe;p=gostls13.git 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 Run-TryBot: David du Colombier <0intro@gmail.com> TryBot-Result: Gobot Gobot --- diff --git a/src/net/lookup_plan9.go b/src/net/lookup_plan9.go index 11f2349afe..f81e220fc8 100644 --- a/src/net/lookup_plan9.go +++ b/src/net/lookup_plan9.go @@ -198,6 +198,10 @@ func (*Resolver) lookupPort(ctx context.Context, network, service string) (port func (*Resolver) lookupCNAME(ctx context.Context, name string) (cname string, err error) { lines, err := queryDNS(ctx, name, "cname") if err != nil { + if stringsHasSuffix(err.Error(), "dns failure") { + cname = name + "." + err = nil + } return } if len(lines) > 0 {