diff --git a/NEWS b/NEWS index e1f8e0f895..5f25e9265c 100644 --- a/NEWS +++ b/NEWS @@ -104,6 +104,10 @@ Unreleased (2.0.0) * `mongoc_stream_tls_do_handshake` is removed. Use `mongoc_stream_tls_handshake` instead. * `mongoc_stream_tls_check_cert` is removed. Use `mongoc_stream_tls_handshake` instead. * `mongoc_stream_tls_new` is removed. Use `mongoc_stream_tls_new_with_hostname` instead. +* Deprecated URI API has been removed: + * `mongoc_uri_get_service` is removed. Use `mongoc_uri_get_srv_hostname` instead. + * `mongoc_uri_get_read_prefs` is removed. Use `mongoc_uri_get_read_prefs_t` instead. + * `mongoc_uri_get_ssl` is removed. Use `mongoc_uri_get_tls` instead. ### Forwarding headers (`#include <bson.h>` and `#include <mongoc.h>`) diff --git a/src/libmongoc/doc/mongoc_uri_get_read_prefs.rst b/src/libmongoc/doc/mongoc_uri_get_read_prefs.rst deleted file mode 100644 index 3a28e44473..0000000000 --- a/src/libmongoc/doc/mongoc_uri_get_read_prefs.rst +++ /dev/null @@ -1,33 +0,0 @@ -:man_page: mongoc_uri_get_read_prefs - -mongoc_uri_get_read_prefs() -=========================== - -.. warning:: - .. deprecated:: 1.2.0 - - Use :doc:`mongoc_uri_get_read_prefs_t() <mongoc_uri_get_read_prefs_t>` instead. - -Synopsis --------- - -.. code-block:: c - - const bson_t * - mongoc_uri_get_read_prefs (const mongoc_uri_t *uri); - -Parameters ----------- - -* ``uri``: A :symbol:`mongoc_uri_t`. - -Description ------------ - -Fetches a bson document containing read preference tag information from a URI. Note that this does not include the read preference mode. - -Returns -------- - -Returns a bson document that should not be modified or freed if ``uri`` has read preferences, otherwise ``NULL``. - diff --git a/src/libmongoc/doc/mongoc_uri_get_service.rst b/src/libmongoc/doc/mongoc_uri_get_service.rst deleted file mode 100644 index 8f240b5c20..0000000000 --- a/src/libmongoc/doc/mongoc_uri_get_service.rst +++ /dev/null @@ -1,29 +0,0 @@ -:man_page: mongoc_uri_get_service - -mongoc_uri_get_service() -======================== - -.. warning:: - .. deprecated:: 1.21.0 - - Use :symbol:`mongoc_uri_get_srv_hostname()` instead. - -Synopsis --------- - -.. code-block:: c - - const char * - mongoc_uri_get_service (const mongoc_uri_t *uri); - -Parameters ----------- - -* ``uri``: A :symbol:`mongoc_uri_t`. - -Returns the SRV host and domain name of a MongoDB URI. - -Returns -------- - -A string if this URI's scheme is "mongodb+srv://", or NULL if the scheme is "mongodb://". diff --git a/src/libmongoc/doc/mongoc_uri_get_ssl.rst b/src/libmongoc/doc/mongoc_uri_get_ssl.rst deleted file mode 100644 index 11f81d950e..0000000000 --- a/src/libmongoc/doc/mongoc_uri_get_ssl.rst +++ /dev/null @@ -1,34 +0,0 @@ -:man_page: mongoc_uri_get_ssl - -mongoc_uri_get_ssl() -==================== - -.. warning:: - .. deprecated:: 1.15.0 - - Use :doc:`mongoc_uri_get_tls() <mongoc_uri_get_tls>` instead. - - -Synopsis --------- - -.. code-block:: c - - bool - mongoc_uri_get_ssl (const mongoc_uri_t *uri); - -Parameters ----------- - -* ``uri``: A :symbol:`mongoc_uri_t`. - -Description ------------ - -Fetches a boolean indicating if TLS was specified for use in the URI. - -Returns -------- - -Returns a boolean, true indicating that TLS should be used. This returns true if *any* :ref:`TLS option <tls_options>` is specified. - diff --git a/src/libmongoc/doc/mongoc_uri_t.rst b/src/libmongoc/doc/mongoc_uri_t.rst index dba547fe8e..fd2ba609a7 100644 --- a/src/libmongoc/doc/mongoc_uri_t.rst +++ b/src/libmongoc/doc/mongoc_uri_t.rst @@ -349,12 +349,9 @@ MONGOC_URI_SAFE safe {tr mongoc_uri_get_options mongoc_uri_get_password mongoc_uri_get_read_concern - mongoc_uri_get_read_prefs mongoc_uri_get_read_prefs_t mongoc_uri_get_replica_set mongoc_uri_get_server_monitoring_mode - mongoc_uri_get_service - mongoc_uri_get_ssl mongoc_uri_get_string mongoc_uri_get_srv_hostname mongoc_uri_get_srv_service_name diff --git a/src/libmongoc/src/mongoc/mongoc-uri.c b/src/libmongoc/src/mongoc/mongoc-uri.c index fb8e91baf2..a4ba010aa1 100644 --- a/src/libmongoc/src/mongoc/mongoc-uri.c +++ b/src/libmongoc/src/mongoc/mongoc-uri.c @@ -2555,13 +2555,6 @@ mongoc_uri_get_srv_hostname (const mongoc_uri_t *uri) } -const char * -mongoc_uri_get_service (const mongoc_uri_t *uri) -{ - return mongoc_uri_get_srv_hostname (uri); -} - - /* Initial DNS Seedlist Discovery Spec: `srvServiceName` requires a string value * and defaults to "mongodb". */ static const char *const mongoc_default_srv_service_name = "mongodb"; @@ -2664,13 +2657,6 @@ mongoc_uri_get_string (const mongoc_uri_t *uri) } -const bson_t * -mongoc_uri_get_read_prefs (const mongoc_uri_t *uri) -{ - BSON_ASSERT (uri); - return mongoc_read_prefs_get_tags (uri->read_prefs); -} - char * mongoc_uri_unescape (const char *escaped_string) { @@ -2824,11 +2810,6 @@ mongoc_uri_get_tls (const mongoc_uri_t *uri) /* IN */ return false; } -bool -mongoc_uri_get_ssl (const mongoc_uri_t *uri) /* IN */ -{ - return mongoc_uri_get_tls (uri); -} const char * mongoc_uri_get_server_monitoring_mode (const mongoc_uri_t *uri) diff --git a/src/libmongoc/src/mongoc/mongoc-uri.h b/src/libmongoc/src/mongoc/mongoc-uri.h index 770a004945..50ca454b91 100644 --- a/src/libmongoc/src/mongoc/mongoc-uri.h +++ b/src/libmongoc/src/mongoc/mongoc-uri.h @@ -108,9 +108,6 @@ mongoc_uri_new_for_host_port (const char *hostname, uint16_t port) BSON_GNUC_WAR MONGOC_EXPORT (const mongoc_host_list_t *) mongoc_uri_get_hosts (const mongoc_uri_t *uri); -BSON_DEPRECATED_FOR (mongoc_uri_get_srv_hostname) -MONGOC_EXPORT (const char *) mongoc_uri_get_service (const mongoc_uri_t *uri); - MONGOC_EXPORT (const char *) mongoc_uri_get_srv_hostname (const mongoc_uri_t *uri); @@ -174,9 +171,6 @@ mongoc_uri_set_option_as_bool (mongoc_uri_t *uri, const char *option, bool value MONGOC_EXPORT (bool) mongoc_uri_set_option_as_utf8 (mongoc_uri_t *uri, const char *option, const char *value); -BSON_DEPRECATED_FOR (mongoc_uri_get_read_prefs_t) -MONGOC_EXPORT (const bson_t *) mongoc_uri_get_read_prefs (const mongoc_uri_t *uri); - MONGOC_EXPORT (const char *) mongoc_uri_get_replica_set (const mongoc_uri_t *uri); @@ -219,8 +213,6 @@ mongoc_uri_get_mechanism_properties (const mongoc_uri_t *uri, bson_t *properties MONGOC_EXPORT (bool) mongoc_uri_set_mechanism_properties (mongoc_uri_t *uri, const bson_t *properties); -BSON_DEPRECATED_FOR (mongoc_uri_get_tls) MONGOC_EXPORT (bool) mongoc_uri_get_ssl (const mongoc_uri_t *uri); - MONGOC_EXPORT (bool) mongoc_uri_get_tls (const mongoc_uri_t *uri); diff --git a/src/libmongoc/tests/test-mongoc-uri.c b/src/libmongoc/tests/test-mongoc-uri.c index d1e4f41910..d3738a944b 100644 --- a/src/libmongoc/tests/test-mongoc-uri.c +++ b/src/libmongoc/tests/test-mongoc-uri.c @@ -2351,21 +2351,18 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf (url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=foo.pem", tlsCertificateKeyFile); uri = mongoc_uri_new (url_buffer); - ASSERT (mongoc_uri_get_ssl (uri)); ASSERT (mongoc_uri_get_tls (uri)); mongoc_uri_destroy (uri); bson_snprintf (url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=foo.pem", tlsCAFile); uri = mongoc_uri_new (url_buffer); - ASSERT (mongoc_uri_get_ssl (uri)); ASSERT (mongoc_uri_get_tls (uri)); mongoc_uri_destroy (uri); bson_snprintf (url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=true", tlsAllowInvalidCertificates); uri = mongoc_uri_new (url_buffer); - ASSERT (mongoc_uri_get_ssl (uri)); ASSERT (mongoc_uri_get_tls (uri)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_SSLALLOWINVALIDCERTIFICATES, false)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, false)); @@ -2374,7 +2371,6 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf (url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=true", tlsAllowInvalidHostnames); uri = mongoc_uri_new (url_buffer); - ASSERT (mongoc_uri_get_ssl (uri)); ASSERT (mongoc_uri_get_tls (uri)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_SSLALLOWINVALIDHOSTNAMES, false)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, false)); @@ -2384,7 +2380,6 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf ( url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=false&%s=foo.pem", tls, tlsCertificateKeyFile); uri = mongoc_uri_new (url_buffer); - ASSERT (!mongoc_uri_get_ssl (uri)); ASSERT (!mongoc_uri_get_tls (uri)); mongoc_uri_destroy (uri); @@ -2392,7 +2387,6 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf ( url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=false&%s=foo.pem", tls, tlsCertificateKeyFile); uri = mongoc_uri_new (url_buffer); - ASSERT (!mongoc_uri_get_ssl (uri)); ASSERT (!mongoc_uri_get_tls (uri)); mongoc_uri_destroy (uri); @@ -2400,7 +2394,6 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf ( url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=false&%s=true", tls, tlsAllowInvalidCertificates); uri = mongoc_uri_new (url_buffer); - ASSERT (!mongoc_uri_get_ssl (uri)); ASSERT (!mongoc_uri_get_tls (uri)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_SSLALLOWINVALIDCERTIFICATES, false)); ASSERT (mongoc_uri_get_option_as_bool (uri, MONGOC_URI_TLSALLOWINVALIDCERTIFICATES, false)); @@ -2410,7 +2403,6 @@ test_mongoc_uri_tls_ssl (const char *tls, bson_snprintf ( url_buffer, sizeof (url_buffer), "mongodb://localhost/?%s=false&%s=false", tls, tlsAllowInvalidHostnames); uri = mongoc_uri_new (url_buffer); - ASSERT (!mongoc_uri_get_ssl (uri)); ASSERT (!mongoc_uri_get_tls (uri)); ASSERT (!mongoc_uri_get_option_as_bool (uri, MONGOC_URI_SSLALLOWINVALIDHOSTNAMES, true)); ASSERT (!mongoc_uri_get_option_as_bool (uri, MONGOC_URI_TLSALLOWINVALIDHOSTNAMES, true)); @@ -2917,7 +2909,8 @@ test_mongoc_uri_duplicates (void) RECREATE_URI (MONGOC_URI_READPREFERENCE "=secondary&" MONGOC_URI_READPREFERENCETAGS "=a:x&" MONGOC_URI_READPREFERENCETAGS "=b:y"); ASSERT_NO_CAPTURED_LOGS (mongoc_uri_get_string (uri)); - bson = mongoc_uri_get_read_prefs (uri); + rp = mongoc_uri_get_read_prefs_t (uri); + bson = mongoc_read_prefs_get_tags (rp); ASSERT_EQUAL_BSON (tmp_bson ("[{'a': 'x'}, {'b': 'y'}]"), bson); RECREATE_URI (MONGOC_URI_REPLICASET "=a&" MONGOC_URI_REPLICASET "=b");