-
Type: Spec Change
-
Resolution: Unresolved
-
Priority: Minor - P4
-
None
-
Component/s: Connection String, URI Options
-
Needed
-
The "Key value pairs" section (ie readPreferenceTags and authMechanismProperties) of the connection string spec states:
A value that represents one or more key and value pairs. Multiple key value pairs are delimited by a comma (","). The key is everything up to the first colon sign (":") and the value is everything afterwards. **If any keys or values containing a comma (",") or a colon (":") they must be URL encoded.**
We should add a test that’s drivers properly URL decode the keys and values in readPreferenceTags and authMechanismProperties. For example this is the test I've written in Python:
quoted_val = "val%21%40%23%24%25%5E%26%2A%28%29_%2B%2C%3A+etc" unquoted_val = "val!@#$%^&*()_+,: etc" uri = (("mongodb://localhost/foo?readpreference=secondary&" "readpreferencetags=dc:west,"+quoted_val+":"+quoted_val+"&" "readpreferencetags=dc:east,use:"+quoted_val)) res = parse_uri(uri) options = { 'readpreference': ReadPreference.SECONDARY.mongos_mode, 'readpreferencetags': [ {'dc': 'west', unquoted_val: unquoted_val}, {'dc': 'east', 'use': unquoted_val} ] } self.assertEqual(options, res['options'])