1--- 2c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3SPDX-License-Identifier: curl 4Title: CURLOPT_SSL_ENABLE_ALPN 5Section: 3 6Source: libcurl 7See-also: 8 - CURLOPT_SSL_ENABLE_NPN (3) 9 - CURLOPT_SSL_OPTIONS (3) 10Protocol: 11 - TLS 12TLS-backend: 13 - All 14Added-in: 7.36.0 15--- 16 17# NAME 18 19CURLOPT_SSL_ENABLE_ALPN - Application Layer Protocol Negotiation 20 21# SYNOPSIS 22 23~~~c 24#include <curl/curl.h> 25 26CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn); 27~~~ 28 29# DESCRIPTION 30 31Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This 32option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl 33is built to use supports it), which can be used to negotiate http2. 34 35# DEFAULT 36 371, enabled 38 39# %PROTOCOLS% 40 41# EXAMPLE 42 43~~~c 44int main(void) 45{ 46 CURL *curl = curl_easy_init(); 47 if(curl) { 48 CURLcode res; 49 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 50 curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L); 51 res = curl_easy_perform(curl); 52 curl_easy_cleanup(curl); 53 } 54} 55~~~ 56 57# %AVAILABILITY% 58 59# RETURN VALUE 60 61Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 62