Uploaded image for project: 'C Driver'
  1. C Driver
  2. CDRIVER-4250

Create public API to expose mongoc_uri_finalize functions

    • Type: Icon: Improvement Improvement
    • Resolution: Won't Do
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None

      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.

            Assignee:
            jmikola@mongodb.com Jeremy Mikola
            Reporter:
            jmikola@mongodb.com Jeremy Mikola
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: