CURLOPT_SOCKS5_GSSAPI_NEC(3)
π CURLOPT_SOCKS5_GSSAPI_NEC π
okay bestie, so this little gem lives in the Library Functions Manual (libcurl section, very demure, very cURL) and it's about SOCKS proxy GSSAPI negotiation protection. i know, i know, the name is giving "I aced the spelling bee" but stay with me, it's actually so simple π«Ά
πΈ NAME πΈ
CURLOPT_SOCKS5_GSSAPI_NEC β the SOCKS proxy GSSAPI negotiation protection option. literally what it says on the tin, no cap β¨
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SOCKS5_GSSAPI_NEC, long nec);
π DESCRIPTION π
okay so you pass a long β set it to 1 to enable, or 0 to disable. that's the whole vibe check π
here's the tea π: as part of the GSSAPI negotiation, a protection mode gets negotiated. and the RFC 1961 (yes, the actual RFC, section 4.3/4.4 to be specific, iykyk) says it should be protected. but the NEC reference implementation? bestie, it does not do that π
so if you enable this option, it lets the protection mode negotiation happen through an unprotected exchange. iconic of it, honestly. so if you're dealing with a server that's not doing the RFC thing, this is your main character option π
β¨ DEFAULT β¨
?
(no really, that's what the manpage says. the default is a mystery, a vibe, a question mark. we love an enigmatic queen π)
π PROTOCOLS π
this functionality affects all supported protocols β every single one, periodt π
π¦ EXAMPLE π¦
here's the whole thing in action, bestie:
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_PROXY, "socks5://proxy");
curl_easy_setopt(curl, CURLOPT_SOCKS5_GSSAPI_NEC, 1L);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
see how it sets the URL, then the proxy to socks5://proxy, then flips CURLOPT_SOCKS5_GSSAPI_NEC to 1L? slay. ate. no crumbs π₯
π AVAILABILITY π
added in curl 7.19.4 β an elder icon, but a icon nonetheless π
β RETURN VALUE β
curl_easy_setopt(3) returns a CURLcode indicating success or error.
CURLE_OK(0) β everything was OK, we're so back π- non-zero β an error occurred π see
libcurl-errors(3)for the deets
π§ SEE ALSO π§
ngl the "unprotected exchange" bit is a real thing you're opting into here β so know what you're doing before you flip it to 1. it's not undefined behaviour, it's just... letting your guard down during negotiation π
k bye bestie, this page was brought to you by libcurl, dated 2026-10-12, from the Library Functions Manual β go forth and negotiate your protection modes, protected or otherwise πβ¨π
π¦ 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