Skip to content

Commit

Permalink
DRIVERS-2679: make delimiting slash between hosts and connection opti…
Browse files Browse the repository at this point in the history
…ons optional (mongodb#1447)

Co-authored-by: Andreas Braun <alcaeus@users.noreply.github.com>
  • Loading branch information
W-A-James and alcaeus authored Sep 18, 2023
1 parent ddfc8b5 commit e09b41d
Show file tree
Hide file tree
Showing 5 changed files with 33 additions and 18 deletions.
4 changes: 3 additions & 1 deletion source/connection-string/connection-string-spec.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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 (",").

Expand Down Expand Up @@ -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
9 changes: 0 additions & 9 deletions source/connection-string/tests/invalid-uris.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
8 changes: 0 additions & 8 deletions source/connection-string/tests/invalid-uris.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions source/connection-string/tests/valid-options.json
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
]
}
13 changes: 13 additions & 0 deletions source/connection-string/tests/valid-options.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit e09b41d

Please sign in to comment.