NNG_URL(5)

πŸ“¦
version 1.12.0 Β· 4 versions
, in ubuntu stonking

πŸ’– 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 be NULL. ever. periodt.
  • u_scheme β€” the URL scheme, like "http" or "inproc". it's always lower case (yes, always, the library said so). never NULL either.
  • 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's NULL.
  • 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 is path[?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