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)
12Added-in: 7.64.0
13---
14
15# NAME
16
17CURLOPT_HTTP09_ALLOWED - allow HTTP/0.9 response
18
19# SYNOPSIS
20
21~~~c
22#include <curl/curl.h>
23
24CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP09_ALLOWED, long allowed);
25~~~
26
27# DESCRIPTION
28
29Pass the long argument *allowed* set to 1L to allow HTTP/0.9 responses.
30
31An HTTP/0.9 response is a server response entirely without headers and only a
32body. You can connect to lots of random TCP services and still get a response
33that curl might consider to be HTTP/0.9.
34
35# DEFAULT
36
370
38
39# %PROTOCOLS%
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# HISTORY
57
58curl allowed HTTP/0.9 responses by default before 7.66.0
59
60Since 7.66.0, libcurl requires this option set to 1L to allow HTTP/0.9
61responses.
62
63# %AVAILABILITY%
64
65# RETURN VALUE
66
67Returns CURLE_OK if HTTP is supported, and CURLE_UNKNOWN_OPTION if not.
68