[CDRIVER-3476] Lowercase options before storing when set via mongoc_uri_set_option_as_* Created: 08/Jan/20 Updated: 28/Oct/23 Resolved: 29/Jun/20 |
|
| Status: | Closed |
| Project: | C Driver |
| Component/s: | libmongoc, uri |
| Affects Version/s: | None |
| Fix Version/s: | 1.17.0-rc0, 1.17.0 |
| Type: | Improvement | Priority: | Major - P3 |
| Reporter: | Kevin Albertson | Assignee: | Andrew Witten (Inactive) |
| Resolution: | Fixed | Votes: | 0 |
| Labels: | new-eng | ||
| Remaining Estimate: | Not Specified | ||
| Time Spent: | Not Specified | ||
| Original Estimate: | Not Specified | ||
| Issue Links: |
|
||||||||||||
| Description |
|
When options are parsed from the connection string passed to mongoc_uri_new, they are internally stored on uri->options after being converted to lowercase in mongoc_uri_split_option here. However, options that are set via the mongoc_uri_set_option_as_* are not lowercased before being stored in uri->options. For consistency, let's lowercase options before storing them in the mongoc_uri_set_options_as_* functions. This should allow us to remove a lot of case sensitivity checks in URI related functions. In addition, there may be a bug caused by the inconsistent casing. Specifying a mongodb+srv URI can result in options being added to a mongoc_uri_t after polling for TXT records in client construction. See the Initial Seedlist Spec for background. TXT records are polled for in mongoc_topology_new here. mongoc_uri_options_validate_names, is used to check for canonical/non-canonical mismatches between uri->options and options being added. It appears to assume that both cases of the options are the same. So I think this scenario could be a bug:
Perhaps adding a test should be a part of this work. We don't have automated SRV tests, but we could simulate the TXT records by calling the private function mongoc_uri_parse_options. |
| Comments |
| Comment by Githook User [ 11/Jul/20 ] |
|
Author: {'name': 'Andrew Witten', 'email': 'andrew.witten@mongodb.com', 'username': 'awitten1'}Message:
|
| Comment by Githook User [ 26/Jun/20 ] |
|
Author: {'name': 'Andrew Witten', 'email': 'andrew.witten@mongodb.com', 'username': 'awitten1'}Message:
|
| Comment by Andrew Witten (Inactive) [ 25/Jun/20 ] |