1---
2c: Copyright (C) Daniel Stenberg, <daniel.se>, et al.
3SPDX-License-Identifier: curl
4Title: CURLOPT_HTTP09_ALLOWED
5Section: 3
6Source: libcurl
7See-also:
8  - CURLOPT_HTTP_VERSION (3)
9  - CURLOPT_SSLVERSION (3)
10---
11
12# NAME
13
14CURLOPT_HTTP09_ALLOWED - allow HTTP/0.9 response
15
16# SYNOPSIS
17
18~~~c
19#include <curl/curl.h>
20
21CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP09_ALLOWED, long allowed);
22~~~
23
24# DESCRIPTION
25
26Pass the long argument *allowed* set to 1L to allow HTTP/0.9 responses.
27
28An HTTP/0.9 response is a server response entirely without headers and only a
29body. You can connect to lots of random TCP services and still get a response
30that curl might consider to be HTTP/0.9!
31
32# DEFAULT
33
34curl allowed HTTP/0.9 responses by default before 7.66.0
35
36Since 7.66.0, libcurl requires this option set to 1L to allow HTTP/0.9
37responses.
38
39# PROTOCOLS
40
41HTTP
42
43# EXAMPLE
44
45~~~c
46int main(void)
47{
48  CURL *curl = curl_easy_init();
49  if(curl) {
50    CURLcode ret;
51    curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
52    curl_easy_setopt(curl, CURLOPT_HTTP09_ALLOWED, 1L);
53    ret = curl_easy_perform(curl);
54  }
55}
56~~~
57
58# AVAILABILITY
59
60Option added in 7.64.0, present along with HTTP.
61
62# RETURN VALUE
63
64Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
65