1 .\" **************************************************************************
3 .\" * Project ___| | | | _ \| |
4 .\" * / __| | | | |_) | |
5 .\" * | (__| |_| | _ <| |___
6 .\" * \___|\___/|_| \_\_____|
8 .\" * Copyright (C) 1998 - 2016, Daniel Stenberg, <daniel@haxx.se>, et al.
10 .\" * This software is licensed as described in the file COPYING, which
11 .\" * you should have received as part of this distribution. The terms
12 .\" * are also available at https://curl.haxx.se/docs/copyright.html.
14 .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
15 .\" * copies of the Software, and permit persons to whom the Software is
16 .\" * furnished to do so, under the terms of the COPYING file.
18 .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
19 .\" * KIND, either express or implied.
21 .\" **************************************************************************
23 .TH CURLOPT_HTTP_VERSION 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
25 CURLOPT_HTTP_VERSION \- specify HTTP protocol version to use
27 #include <curl/curl.h>
29 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP_VERSION, long version);
31 Pass \fIversion\fP a long, set to one of the values described below. They ask
32 libcurl to use the specific HTTP versions. This is not sensible to do unless
33 you have a good reason. You have to set this option if you want to use
34 libcurl's HTTP/2 support.
36 Note that the HTTP version is just a request. libcurl will still prioritize to
37 re-use an existing connection so it might then re-use a connection using a
38 HTTP version you haven't asked for.
40 .IP CURL_HTTP_VERSION_NONE
41 We don't care about what version the library uses. libcurl will use whatever
43 .IP CURL_HTTP_VERSION_1_0
44 Enforce HTTP 1.0 requests.
45 .IP CURL_HTTP_VERSION_1_1
46 Enforce HTTP 1.1 requests.
47 .IP CURL_HTTP_VERSION_2_0
48 Attempt HTTP 2 requests. libcurl will fall back to HTTP 1.1 if HTTP 2 can't be
49 negotiated with the server. (Added in 7.33.0)
51 The alias \fICURL_HTTP_VERSION_2\fP was added in 7.43.0 to better reflect the
53 .IP CURL_HTTP_VERSION_2TLS
54 Attempt HTTP 2 over TLS (HTTPS) only. libcurl will fall back to HTTP 1.1 if
55 HTTP 2 can't be negotiated with the HTTPS server. For clear text HTTP servers,
56 libcurl will use 1.1. (Added in 7.47.0)
57 .IP CURL_HTTP_VERSION_2_PRIOR_KNOWLEDGE
58 Issue non-TLS HTTP requests using HTTP/2 without HTTP/1.1 Upgrade. It requires
59 prior knowledge that the server supports HTTP/2 straight away. HTTPS requests
60 will still do HTTP/2 the standard way with negotiated protocol version in the
61 TLS handshake. (Added in 7.49.0)
63 CURL_HTTP_VERSION_NONE
71 Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
73 .BR CURLOPT_SSLVERSION "(3), " CURLOPT_HTTP200ALIASES "(3), "