NNG_URL(5)
π NNG_URL(5) β the universal resource locator object, bestie π
okay so this is nng_url(5), straight outta the NNG Reference Manual, and it's literally just the little struct that holds your URLs. no cap. let's get into it π¦
β¨ NAME β¨
nng_url β the Universal Resource Locator object π
πΈ SYNOPSIS πΈ
#include <nng/nng.h>
typedef struct nng_url {
char *u_rawurl;
char *u_scheme;
char *u_userinfo;
char *u_host;
char *u_hostname;
char *u_port;
char *u_path;
char *u_query;
char *u_fragment;
char *u_requri;
} nng_url;
π DESCRIPTION π
So an nng_url is a struct for representing URLs. you don't just make one out of thin air, bestie β they get created by parsing a string-formatted URL with nng_url_parse(). that's the whole vibe β¨
you can peek at the individual fields, absolutely go off, but:
π¨ hands off the memory!! Applications must not free or alter the fields. that underlying memory is managed by the library, not by you. it's giving "look, don't touch" π«Ά
here's the field-by-field breakdown, one by one, no skips:
u_rawurlβ the unparsed URL string, exactly as it came in. this will never beNULL. ever. periodt.u_schemeβ the URL scheme, like"http"or"inproc". it's always lower case (yes, always, the library said so). neverNULLeither.u_userinfoβ the username and password, but only if they were supplied in the URL string. if they weren't?NULL. be so for real, don't assume it's there.u_hostβ the full host part of the URL, and yes that includes the port if there is one (separated by a colon, obviously).u_hostnameβ the name of the host. in some cases this can be the empty string, which is a little quirky of it but okay.u_portβ the port. may be empty if it's irrelevant or just wasn't specified. it's fine. it's fine.u_pathβ the path, typically the one you'd use with HTTP or WebSockets. if it wasn't specified, you get the empty string.u_queryβ the query info, aka the bit that typically follows a?in the URL. if it's not present, it'sNULL.u_fragmentβ this one's for specifying an anchor: the part after the#in a URL. if it's not present,NULL.u_requriβ the full Request-URI, which ispath[?query][#fragment]. if it wasn't specified, it's the empty string.
π Note Other fields may also be present in there β but only the ones documented above are safe for application use. the rest are giving "not for you" energy, so don't touch them π
π‘ Tip wanna learn more about Universal Resource Locators in general? the lore is in RFC 3986 β https://tools.ietf.org/html/rfc3986. go read it, it's iconic π
π SEE ALSO π
and that's the whole page, bestie π§π this was NNG_URL(5), served fresh from the NNG Reference Manual, dated 2026-06-30. slay, go parse something, and remember: look at the fields, don't free the fields. mwah πβ¨π
π¦ where this page comes from
- ubuntu stonking: libnng-dev 1.12.0-1 Β· MIT OR Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms