From 3e3dd5ef9bec1db07bcb340691b58af9099446cd Mon Sep 17 00:00:00 2001 From: gdamore Date: Tue, 31 Dec 2024 17:51:33 +0000 Subject: deploy: c3bb282e916bf1ece77bf81901878498e39f0017 --- ref/api/url.html | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'ref/api/url.html') diff --git a/ref/api/url.html b/ref/api/url.html index 9276c836..259ad350 100644 --- a/ref/api/url.html +++ b/ref/api/url.html @@ -228,20 +228,12 @@ and RFC 3968.

In Scalability Protocols, this concept is extended, although it includes schemes that are not part of the IETF standards.

URL Structure

-
typedef struct nng_url {
-    const char *u_scheme;
-    char       *u_userinfo;
-    char       *u_hostname;
-    uint16_t   u_port;
-    char       *u_path;
-    char       *u_query;
-    char       *u_fragment;
-} nng_url;
+
typedef struct nng_url nng_url;
 
 const char *nng_url_scheme(const nng_url *url);
 const char *nng_url_userinfo(const nng_url *url);
 const char *nng_url_hostname(const nng_url *url);
-uint16_t    nng_url_port(const nng_url *url);
+uint32_t    nng_url_port(const nng_url *url);
 const char *nng_url_path(const nng_url *url);
 const char *nng_url_query(const nng_url *url);
 const char *nng_url_fragment(const nng_url *url):
@@ -310,7 +302,7 @@ and creates a dynamically allocated nng_url, returning it in ur
 

Only nng_url_free should be used to deallocate nng_url objects.

Clone a URL

-
int nng_url_clone(nng_url **dup, nng_url *url);
+
int nng_url_clone(nng_url **dup, const nng_url *url);
 

The nng_url_clone function creates a copy of url, and returns it in dup.

Destroy a URL

@@ -319,6 +311,14 @@ and creates a dynamically allocated nng_url, returning it in ur

The nng_url_free function destroy an nng_url object created with either nng_url_parse or nng_url_free.

This is the only correct way to destroy an nng_url object.

+

Update a URL Port

+
void nng_url_resolve_port(nng_url *url, uint32_t port);
+
+

In order to use dynamic port allocation, some transports and schemes allow a port number of zero +to be specified. When this is done, the system will allocate a free port when the port is bound +while starting a listener. Once this is done, the port number may need to be updated so that the +URL can be used to configure a client. The nng_url_resolve_port function updates such +a URL with a new port. This will have no effect if the URL already has a non-zero port number.

See Also

More information about Universal Resource Locators can be found in RFC 3986.

-- cgit v1.2.3-70-g09d2