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 14--- 15 16# NAME 17 18CURLOPT_SSL_ENABLE_ALPN - Application Layer Protocol Negotiation 19 20# SYNOPSIS 21 22~~~c 23#include <curl/curl.h> 24 25CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn); 26~~~ 27 28# DESCRIPTION 29 30Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This 31option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl 32is built to use supports it), which can be used to negotiate http2. 33 34# DEFAULT 35 361, enabled 37 38# EXAMPLE 39 40~~~c 41int main(void) 42{ 43 CURL *curl = curl_easy_init(); 44 if(curl) { 45 CURLcode res; 46 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 47 curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_ALPN, 0L); 48 res = curl_easy_perform(curl); 49 curl_easy_cleanup(curl); 50 } 51} 52~~~ 53 54# AVAILABILITY 55 56Added in 7.36.0 57 58# RETURN VALUE 59 60Returns CURLE_OK if the option is supported, and CURLE_UNKNOWN_OPTION if not. 61