[CDRIVER-4250] Create public API to expose mongoc_uri_finalize functions Created: 20/Dec/21  Updated: 28/Dec/21  Resolved: 28/Dec/21

Status: Closed
Project: C Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Unknown
Reporter: Jeremy Mikola Assignee: Jeremy Mikola
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Depends
is depended on by PHPC-2021 Use mongoc_uri_finalize_options to va... Closed
Related
is related to PHPC-1752 Load Balancer Support Closed
is related to CDRIVER-3723 Validate URI options on client/client... Closed

 Description   

I have some recollection of discussing this with kevin.albertson a while back, but I found no existing ticket.

mongoc-uri.c includes several internal functions to validate interactions between URI options:

  • mongoc_uri_finalize_auth
  • mongoc_uri_finalize_directconnection
  • mongoc_uri_finalize_loadbalanced
  • mongoc_uri_finalize_srv
  • mongoc_uri_finalize_tls

These functions are only called from mongoc_uri_parse. For wrapping drivers such as PHP, that means they will only apply to parsed URI strings. If those wrapping drivers later set URI options through functions such as mongoc_uri_set_option_as_int32, those options will never be validated by libmongoc.

Historically, PHPC has maintained its own copies of some of these functions; however, it looks like we missed introducing a copy of mongoc_uri_finalize_loadbalanced. I only noticed this issue when working on PHPC-1900 and PHPC-1908 and realizing we'd need to copy mongoc_uri_finalize_srv.

It's quite possible that these functions could depend on other private URI APIs to validate, so I think it'd make the most sense for libmongoc to provide a common, public API that calls all of these methods. That could still be called from mongoc_uri_parse but also be available for wrapping drivers to call after they are done setting additional, individual options.



 Comments   
Comment by Jeremy Mikola [ 28/Dec/21 ]

CDRIVER-3723 will be implemented instead of this issue.

Comment by Jeremy Mikola [ 21/Dec/21 ]

https://github.com/mongodb/mongo-c-driver/pull/919

Generated at Wed Feb 07 21:20:23 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.