CURLOPT_SERVICE_NAME(3)
β¨ CURLOPT_SERVICE_NAME β¨
okay bestie, welcome to the CURLOPT_SERVICE_NAME page β it's part of the libcurl Library Functions Manual, and it's literally all about the name of the service you use for auth. let's get into it π
πΈ NAME πΈ
CURLOPT_SERVICE_NAME β the authentication service name, aka "what do i call myself when i show up to the auth party" π
π¦ SYNOPSIS π¦
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SERVICE_NAME, char *name);
π DESCRIPTION π
so basically, you pass a char pointer as the parameter, and it points at a string holding the name of the service β and that name gets used for the DIGEST-MD5, SPNEGO and Kerberos 5 authentication mechanisms. iykyk π₯
the default service names are "ftp", "HTTP", "imap", "ldap", "pop" and "smtp". what this option does is let you change them. slay, customization π
the application does not have to keep the string around after setting this option β so you can let it go, no strings attached (literally) π§
and if you use this option multiple times? the last set string just overrides the previous ones, no drama. set it to NULL to disable its use again. periodt π
β DEFAULT β
See above β the defaults are literally listed up there in the description, bestie π
π PROTOCOLS π
this functionality affects ftp, http, imap, ldap, pop3 and smtp π«Ά
π EXAMPLE π
int main(void)
{
CURL *curl = curl_easy_init();
if(curl) {
CURLcode result;
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
curl_easy_setopt(curl, CURLOPT_SERVICE_NAME, "custom");
result = curl_easy_perform(curl);
}
}
look at that little "custom" service name living its main character life β¨
π AVAILABILITY π
Added in curl 7.43.0 β vintage but iconic π
π RETURN VALUE π
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK (that's 0) means everything was OK π β non-zero means an error occurred, and you should go see libcurl-errors(3) for the tea π
π SEE ALSO π
and that's the whole vibe check, bestie π this page came to you from libcurl, dated 2026-10-12, and yes the page name is also CURLOPT_SERVICE_NAME(3) because we keep it consistent around here π¦ mwah, go set some service names β¨
π¦ 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