gnurl_url(3)

πŸ“¦ version 7.72.0, in nixos 26.05, nixpkgs unstable

πŸ¦‹ gnurl_url(3) β€” the libgnurl manual, but make it cute πŸ¦‹

okay so this is the page for gnurl_url(3) from the libgnurl manual, and honestly? it's a little baby function that hands you a whole new URL toy to play with. bestie, let's get into it πŸ’…


✨ NAME ✨

curl_url β€” returns a new CURLU handle πŸŽ€

✨ SYNOPSIS ✨

#include <gnurl/curl.h>

CURLU *curl_url();

✨ DESCRIPTION ✨

so what this does is it allocates and returns a pointer to a fresh, brand-new CURLU handle πŸ’– and like, that handle is what you're gonna use for all your further URL API adventures. that's it. that's the whole vibe. main character energy: it just shows up and gives you a handle. iconic ✨

✨ RETURN VALUE ✨

  • it returns a CURLU * if everything slayed and it worked πŸ’…
  • or NULL if it ran out of memory 😭 (out of memory, bestie, not your fault)

✨ EXAMPLE ✨

okay here's the whole thing, enjoy, it's giving tutorial:

  CURLUcode rc;
  CURLU *url = curl_url();
  rc = curl_url_set(url, CURLUPART_URL, "https://example.com", 0);
  if(!rc) {
    char *scheme;
    rc = curl_url_get(url, CURLUPART_SCHEME, &scheme, 0);
    if(!rc) {
      printf("the scheme is %s\n", scheme);
      curl_free(scheme);
    }
    curl_url_cleanup(url);
  }

like look at it. grab the handle, set the URL, pull the scheme out, print it, free the string, clean up. so tidy. we love a responsible queen who calls curl_url_cleanup 🫢

✨ AVAILABILITY ✨

Added in curl 7.62.0 β€” so it's been around a minute, no cap πŸ“…

✨ SEE ALSO ✨


bestie reminder: the title up top is gnurl_url(3) and the manual is libgnurl β€” that's the whole header, consider it folded in and slayed πŸ’–

and that's a wrap! this page came from libcurl, dated 6 Aug 2018, and it lives at gnurl_url(3) in the manual. mwah, go build something cute πŸ’œπŸ§š

πŸ“¦ where this page comes from