diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.json b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.json new file mode 100644 index 0000000000..decc83ce10 --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.json @@ -0,0 +1,16 @@ +{ + "uri": "mongodb+srv://TEST1.TEST.BUILD.10GEN.CC", + "seeds": [ + "localhost.test.build.10gen.cc:27017", + "localhost.test.build.10gen.cc:27018" + ], + "hosts": [ + "localhost:27017", + "localhost:27018", + "localhost:27019" + ], + "options": { + "ssl": true + }, + "ping": true +} \ No newline at end of file diff --git a/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.yml b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.yml new file mode 100644 index 0000000000..a0e06c466c --- /dev/null +++ b/testdata/initial-dns-seedlist-discovery/replica-set/uri-with-uppercase-hostname.yml @@ -0,0 +1,11 @@ +uri: "mongodb+srv://TEST1.TEST.BUILD.10GEN.CC" +seeds: + - localhost.test.build.10gen.cc:27017 + - localhost.test.build.10gen.cc:27018 +hosts: + - localhost:27017 + - localhost:27018 + - localhost:27019 +options: + ssl: true +ping: true \ No newline at end of file diff --git a/x/mongo/driver/dns/dns.go b/x/mongo/driver/dns/dns.go index 848554d3a1..6573a4c1ad 100644 --- a/x/mongo/driver/dns/dns.go +++ b/x/mongo/driver/dns/dns.go @@ -104,8 +104,8 @@ func (r *Resolver) fetchSeedlistFromSRV(host string, srvName string, stopOnErr b } func validateSRVResult(recordFromSRV, inputHostName string) error { - separatedInputDomain := strings.Split(inputHostName, ".") - separatedRecord := strings.Split(recordFromSRV, ".") + separatedInputDomain := strings.Split(strings.ToLower(inputHostName), ".") + separatedRecord := strings.Split(strings.ToLower(recordFromSRV), ".") if len(separatedRecord) < 2 { return errors.New("DNS name must contain at least 2 labels") }