CURLOPT_SSL_ENABLE_NPN.md (1314B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_SSL_ENABLE_NPN 5 Section: 3 6 Source: libcurl 7 See-also: 8 - CURLOPT_SSL_ENABLE_ALPN (3) 9 - CURLOPT_SSL_OPTIONS (3) 10 Protocol: 11 - TLS 12 TLS-backend: 13 - All 14 Added-in: 7.36.0 15 --- 16 17 # NAME 18 19 CURLOPT_SSL_ENABLE_NPN - use NPN 20 21 # SYNOPSIS 22 23 ~~~c 24 #include <curl/curl.h> 25 26 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_SSL_ENABLE_NPN, long npn); 27 ~~~ 28 29 # DESCRIPTION 30 31 Deprecated since 7.86.0 Setting this option has no function. 32 33 Pass a long as parameter, 0 or 1 where 1 is for enable and 0 for disable. This 34 option enables/disables NPN in the SSL handshake (if the SSL backend libcurl 35 is built to use supports it), which can be used to negotiate http2. 36 37 # DEFAULT 38 39 1, enabled 40 41 # %PROTOCOLS% 42 43 # EXAMPLE 44 45 ~~~c 46 int main(void) 47 { 48 CURL *curl = curl_easy_init(); 49 if(curl) { 50 CURLcode res; 51 curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/"); 52 curl_easy_setopt(curl, CURLOPT_SSL_ENABLE_NPN, 1L); 53 res = curl_easy_perform(curl); 54 curl_easy_cleanup(curl); 55 } 56 } 57 ~~~ 58 59 # DEPRECATED 60 61 Deprecated since 7.86.0 62 63 # %AVAILABILITY% 64 65 # RETURN VALUE 66 67 curl_easy_setopt(3) returns a CURLcode indicating success or error. 68 69 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 70 libcurl-errors(3).