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