CURLOPT_SSL_ENABLE_ALPN(3)
π CURLOPT_SSL_ENABLE_ALPN β it's giving "let's negotiate, bestie" β¨
okay so real quick, this page lives in the Library Functions Manual, and it's all about CURLOPT_SSL_ENABLE_ALPN, which stands for Application Layer Protocol Negotiation (yes the whole thing, no cap π«Ά).
πΈ NAME πΈ
CURLOPT_SSL_ENABLE_ALPN β Application Layer Protocol Negotiation, aka the little handshake conversation that decides what protocol y'all are actually gonna speak π¬
π SYNOPSIS π
#include <curl/curl.h>
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn);
β¨ DESCRIPTION β¨
So like, you pass a long as the parameter, and it's either 0 or 1 β 1 means enable, 0 means disable, that's the whole vibe check π₯
This option enables/disables ALPN in the SSL handshake (but only if the SSL backend libcurl is built to use actually supports it, iykyk β if it doesn't, well, nothing happens π). And what's the point? It can be used to negotiate http2. that's the main character move right there π
π DEFAULT π
1, enabled β yeah she's on by default, slaying from the start π
π¦ PROTOCOLS π¦
This functionality affects all TLS based protocols: HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. β literally the whole TLS friend group π
All TLS backends support this option. all of them. no exceptions. slay π
πΈ 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_SSL_ENABLE_ALPN, 0L);
result = curl_easy_perform(curl);
curl_easy_cleanup(curl);
}
}
(not us turning ALPN off with that 0L β bold choice, iconic honestly π)
β AVAILABILITY β
Added in curl 7.36.0 β she's been around a minute, respect her legacy π
π§ RETURN VALUE π§
curl_easy_setopt(3) returns a CURLcode indicating success or error, fr fr.
CURLE_OK (0) means everything was OK π β and non-zero means an error occurred π, so go see libcurl-errors(3) for the whole breakdown.
π«Ά SEE ALSO π«Ά
go read those too bestie, they're lowkey related π
mwah π β this page is from libcurl, dated 2026-10-12, and the page itself is CURLOPT_SSL_ENABLE_ALPN(3). now go negotiate some protocols, you got this π¦β¨
π¦ 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