Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1760

Driver accepts two and one part hostnames in SRV URIs

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Minor - P4 Minor - P4
    • 3.9
    • Affects Version/s: 3.7.2
    • Component/s: None
    • None

      Initial seed list discovery spec requires that a DNS name given with SRV URI has a minimum of 3 parts total. However the Python driver accepts and queries two (and one) part names:

      >>> pymongo.MongoClient('mongodb+srv://google.com')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/mongo_client.py", line 514, in __init__
          res = uri_parser.parse_uri(entity, port, warn=True)
        File "pymongo/uri_parser.py", line 399, in parse_uri
          nodes = _get_dns_srv_hosts(fqdn)
        File "pymongo/uri_parser.py", line 289, in _get_dns_srv_hosts
          raise ConfigurationError(str(exc))
      pymongo.errors.ConfigurationError: None of DNS query names exist: _mongodb._tcp.google.com., _mongodb._tcp.google.com.nyc.mongodb.network.
      >>> pymongo.MongoClient('mongodb+srv://com')
      Traceback (most recent call last):
        File "<stdin>", line 1, in <module>
        File "pymongo/mongo_client.py", line 514, in __init__
          res = uri_parser.parse_uri(entity, port, warn=True)
        File "pymongo/uri_parser.py", line 399, in parse_uri
          nodes = _get_dns_srv_hosts(fqdn)
        File "pymongo/uri_parser.py", line 289, in _get_dns_srv_hosts
          raise ConfigurationError(str(exc))
      pymongo.errors.ConfigurationError: None of DNS query names exist: _mongodb._tcp.com., _mongodb._tcp.com.nyc.mongodb.network.
      

      https://github.com/mongodb/specifications/blob/master/source/initial-dns-seedlist-discovery/initial-dns-seedlist-discovery.rst#seedlist-discovery

            Assignee:
            bernie@mongodb.com Bernie Hackett
            Reporter:
            oleg.pudeyev@mongodb.com Oleg Pudeyev (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: