From e09b41df206f9efaa36ba4c332c47d04ddb7d6d1 Mon Sep 17 00:00:00 2001 From: Warren James Date: Mon, 18 Sep 2023 13:15:19 -0400 Subject: [PATCH] DRIVERS-2679: make delimiting slash between hosts and connection options optional (#1447) Co-authored-by: Andreas Braun --- .../connection-string-spec.rst | 4 +++- .../connection-string/tests/invalid-uris.json | 9 --------- source/connection-string/tests/invalid-uris.yml | 8 -------- .../connection-string/tests/valid-options.json | 17 +++++++++++++++++ .../connection-string/tests/valid-options.yml | 13 +++++++++++++ 5 files changed, 33 insertions(+), 18 deletions(-) diff --git a/source/connection-string/connection-string-spec.rst b/source/connection-string/connection-string-spec.rst index 1cad9f4455..dfad4f9009 100644 --- a/source/connection-string/connection-string-spec.rst +++ b/source/connection-string/connection-string-spec.rst @@ -86,7 +86,7 @@ Above and beyond that restriction, drivers SHOULD require connection string user ---------------- Host Information ---------------- -Unlike a standard URI, the connection string allows for identifying multiple hosts. The host information section of the connection string is delimited by the trailing slash ("/") or end of string. +Unlike a standard URI, the connection string allows for identifying multiple hosts. The host information section of the connection string MAY be delimited by the trailing slash ("/") or end of string. The host information must contain at least one host identifier but may contain more (see the alternative hosts / ports in the general syntax diagram above). Multiple host identifiers are delimited by a comma (","). @@ -389,3 +389,5 @@ Changelog :2022-10-05: Remove spec front matter and reformat changelog. :2022-12-27: Note that host information ends with a "/" character in connection options description. +:2023-08-02: Make delimiting slash between host information and connection options + optional and update tests diff --git a/source/connection-string/tests/invalid-uris.json b/source/connection-string/tests/invalid-uris.json index e04da2b236..a7accbd27d 100644 --- a/source/connection-string/tests/invalid-uris.json +++ b/source/connection-string/tests/invalid-uris.json @@ -162,15 +162,6 @@ "auth": null, "options": null }, - { - "description": "Missing delimiting slash between hosts and options", - "uri": "mongodb://example.com?w=1", - "valid": false, - "warning": null, - "hosts": null, - "auth": null, - "options": null - }, { "description": "Incomplete key value pair for option", "uri": "mongodb://example.com/?w", diff --git a/source/connection-string/tests/invalid-uris.yml b/source/connection-string/tests/invalid-uris.yml index 395e60eed9..79e110c79d 100644 --- a/source/connection-string/tests/invalid-uris.yml +++ b/source/connection-string/tests/invalid-uris.yml @@ -143,14 +143,6 @@ tests: hosts: ~ auth: ~ options: ~ - - - description: "Missing delimiting slash between hosts and options" - uri: "mongodb://example.com?w=1" - valid: false - warning: ~ - hosts: ~ - auth: ~ - options: ~ - description: "Incomplete key value pair for option" uri: "mongodb://example.com/?w" diff --git a/source/connection-string/tests/valid-options.json b/source/connection-string/tests/valid-options.json index 4c2bded9e7..01bc2264bb 100644 --- a/source/connection-string/tests/valid-options.json +++ b/source/connection-string/tests/valid-options.json @@ -20,6 +20,23 @@ "options": { "authmechanism": "MONGODB-CR" } + }, + { + "description": "Missing delimiting slash between hosts and options", + "uri": "mongodb://example.com?tls=true", + "valid": true, + "warning": false, + "hosts": [ + { + "type": "hostname", + "host": "example.com", + "port": null + } + ], + "auth": null, + "options": { + "tls": true + } } ] } diff --git a/source/connection-string/tests/valid-options.yml b/source/connection-string/tests/valid-options.yml index e1b94039c8..8cb0dea3a6 100644 --- a/source/connection-string/tests/valid-options.yml +++ b/source/connection-string/tests/valid-options.yml @@ -15,3 +15,16 @@ tests: db: "admin" options: authmechanism: "MONGODB-CR" + - + description: "Missing delimiting slash between hosts and options" + uri: "mongodb://example.com?tls=true" + valid: true + warning: false + hosts: + - + type: "hostname" + host: "example.com" + port: ~ + auth: ~ + options: + tls: true