1--- 2c: Copyright (C) Daniel Stenberg, <daniel.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) 10--- 11 12# NAME 13 14CURLOPT_SSL_ENABLE_ALPN - Application Layer Protocol Negotiation 15 16# SYNOPSIS 17 18~~~c 19#include <curl/curl.h> 20 21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_ALPN, long npn); 22~~~ 23 24# DESCRIPTION 25 26Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This 27option enables/disables ALPN in the SSL handshake (if the SSL backend libcurl 28is built to use supports it), which can be used to negotiate http2. 29 30# DEFAULT 31 321, enabled 33 34# PROTOCOLS 35 36HTTP 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