CURLOPT_SSL_ENABLE_NPN(3)

πŸ’… CURLOPT_SSL_ENABLE_NPN(3) πŸ’…

okay so this is a page from the Library Functions Manual, and bestie... it's a little bit of a ghost town page ngl. but we're gonna get through it together 🫢


✨ NAME ✨

CURLOPT_SSL_ENABLE_NPN β€” the "use NPN" option πŸ’« (yes. that's it. that's the whole name. iconic of it honestly)


🌸 SYNOPSIS 🌸

#include <curl/curl.h>

CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_NPN, long npn);

πŸŽ€ DESCRIPTION πŸŽ€

hiii so first things first, and I need you to sit down for this one:

Deprecated since 7.86.0. Setting this option has no function. like... none. zero. it does literally nothing. it's giving retired. it's giving "still on the roster but hasn't been to a meeting since 2022" 😭

okay but for the lore ✨ β€” here's what it used to be about, and what the option still formally takes:

  • you pass a long as the parameter
  • it's 0 or 1
  • 1 = enable, 0 = disable
  • what it did: enabled/disables NPN in the SSL handshake (but only if the SSL backend libcurl is built to use actually supports it, iykyk)
  • and the whole point of that handshake party trick was that it can be used to negotiate http2 πŸ¦‹

πŸ’– DEFAULT πŸ’–

1, enabled. (or as I like to call it, the default that no longer does anything πŸ₯²)


🌈 PROTOCOLS 🌈

This functionality affects all TLS based protocols, bestie. all of them. the whole squad:

HTTPS, FTPS, IMAPS, POP3S, SMTPS etc. πŸ‘‘

also: All TLS backends support this option.


πŸ¦‹ EXAMPLE πŸ¦‹

here's the moment you've been waiting for, the example, and yes it does call the deprecated thing, don't @ me, I'm just the messenger πŸ’…

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_NPN, 1L);
    result = curl_easy_perform(curl);
    curl_easy_cleanup(curl);
  }
}

πŸ’€ DEPRECATED πŸ’€

Deprecated since 7.86.0. that's it. that's the section. the whole section. it said what it said 😭


⭐ AVAILABILITY ⭐

Added in curl 7.36.0 β€” so it was born, and then it was deprecated. a whole arc. a whole character development speedrun 🧚


πŸ”₯ RETURN VALUE πŸ”₯

curl_easy_setopt(3) returns a CURLcode indicating success or error.

  • CURLE_OK (0) means everything was OK πŸŽ‰
  • non-zero means an error occurred β€” go check libcurl-errors(3) to find out what went wrong πŸ™ˆ

πŸ‘‘ SEE ALSO πŸ‘‘


and that's the page, bestie!! mwah πŸ’‹

signed off by the libcurl girlies, dated 2026-10-12 β€” catch you in the next manpage, slay βœ¨πŸ’œ

πŸ“¦ where this page comes from