CURL.SetOptionHTTPVersion
-------------------------

Sets which HTTP version is used.

| Component | Version | macOS | Windows | Linux | Server | iOS SDK |
|---|---|---|---|---|---|---|
| [CURL](component_CURL.md) | [2.5](newinversion25.md) | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |

MBS( "CURL.SetOptionHTTPVersion"; curl; Value ) 

**MBS**( **"CURL.SetOptionHTTPVersion";** /\* Sets which HTTP version is used. \*/  
**$curl**; /\* The CURL session handle. \*/   
**$Value**) /\* Sets the HTTP Version.e.g. 2 \*/ 

### Parameters

| Parameter | Description | Example |
|---|---|---|
| curl | The CURL session handle. | $curl |
| Value | Sets the HTTP Version. | 2 |

### Result

Returns "OK" on success.

### Description

Sets which HTTP version is used.   
This is not sensible to do unless you have a good reason.  
  
| CURL\_HTTP\_VERSION\_NONE | 0 | We don't care about what version the library uses. libcurl will use whatever it thinks fit. |
|---|--:|---|
| CURL\_HTTP\_VERSION\_1\_0 | 1 | Enforce HTTP 1.0 requests. |
| CURL\_HTTP\_VERSION\_1\_1 | 2 | Enforce HTTP 1.1 requests. |
| CURL\_HTTP\_VERSION\_2\_0 | 3 | please use HTTP 2 in the request |
| CURL\_HTTP\_VERSION\_2TLS | 4 | use version 2 for HTTPS, version 1.1 for HTTP |
| CURL\_HTTP\_VERSION\_2\_PRIOR\_KNOWLEDGE | 5 | please use HTTP 2 without HTTP/1.1 Upgrade |

See also [HTTP\_VERSION](https://curl.haxx.se/libcurl/c/CURLOPT_HTTP_VERSION.html) option in CURL manual.

### See also

- [CURL.GetOptionHTTPHeader](CURLGetOptionHTTPHeader.md)
- [CURL.SetOptionCustomRequest](CURLSetOptionCustomRequest.md)
- [CURL.SetOptionHTTP200Aliases](CURLSetOptionHTTP200Aliases.md)
- [CURL.SetOptionHTTPHeader](CURLSetOptionHTTPHeader.md)
- [CURL.SetOptionProxyType](CURLSetOptionProxyType.md)
- [CURL.SetOptionRTSPSessionID](CURLSetOptionRTSPSessionID.md)
- [CURL.SetOptionSSLVersion](CURLSetOptionSSLVersion.md)

Created 18th August 2014 , last changed 29th April 2017

  
[CURL.SetOptionHTTPTransferDecoding](CURLSetOptionHTTPTransferDecoding.md) - [CURL.SetOptionHappyEyeballsTimeOutMS](CURLSetOptionHappyEyeballsTimeOutMS.md)

[HTML Version](CURLSetOptionHTTPVersion.shtml)