curl_url(3)
β¨ curl_url(3) β¨
okay so bestie, welcome to the Library Functions Manual β this is the page for curl_url, and honestly it's the main character of the whole URL API squad π
πΈ NAME πΈ
curl_url β create a URL handle π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLU *curl_url();
π DESCRIPTION π
So this function allocates a URL object and hands you back a CURLU handle for it β and that handle is literally the input to every other URL API function. She's the entry point, the door, the vibe check at the front of the club π«Ά
It's a handle to a URL object that holds β or can hold β URL components for a single URL. When the object first gets created, there's obviously no components stored in there yet (baby's empty, she's fresh β¨). You set them in the object afterwards with the curl_url_set(3) function.
ok real talk though: the object must be destroyed with a call to curl_url_cleanup(3) when you don't need it anymore. like, don't just abandon her, that's not the move π
π PROTOCOLS π
This functionality affects all supported protocols β no cap, all of them π
π EXAMPLE π
int main(void)
{
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);
}
}
β AVAILABILITY β
Added in curl 7.62.0 β she's been around a minute π
π₯ RETURN VALUE π₯
Returns a CURLU * if it goes well, or NULL if you're out of memory π
π§ SEE ALSO π§
CURLOPT_CURLU(3)curl_url_cleanup(3)curl_url_dup(3)curl_url_get(3)curl_url_set(3)curl_url_strerror(3)
laters bestie π«Ά this page is from libcurl, dated 2026-10-12, and it's the curl_url(3) page β go build something iconic with it β¨π
π¦ where this page comes from
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- fedora 44: libcurl-devel 8.18.0-14.fc44 Β· curl
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms