CURLOPT_HTTP09_ALLOWED.md (1369B)
1 --- 2 c: Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al. 3 SPDX-License-Identifier: curl 4 Title: CURLOPT_HTTP09_ALLOWED 5 Section: 3 6 Source: libcurl 7 Protocol: 8 - HTTP 9 See-also: 10 - CURLOPT_HTTP_VERSION (3) 11 - CURLOPT_SSLVERSION (3) 12 Added-in: 7.64.0 13 --- 14 15 # NAME 16 17 CURLOPT_HTTP09_ALLOWED - allow HTTP/0.9 response 18 19 # SYNOPSIS 20 21 ~~~c 22 #include <curl/curl.h> 23 24 CURLcode curl_easy_setopt(CURL *handle, CURLOPT_HTTP09_ALLOWED, long allowed); 25 ~~~ 26 27 # DESCRIPTION 28 29 Pass the long argument *allowed* set to 1L to allow HTTP/0.9 responses. 30 31 An HTTP/0.9 response is a server response entirely without headers and only a 32 body. You can connect to lots of random TCP services and still get a response 33 that curl might consider to be HTTP/0.9. 34 35 # DEFAULT 36 37 0 38 39 # %PROTOCOLS% 40 41 # EXAMPLE 42 43 ~~~c 44 int 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 58 curl allowed HTTP/0.9 responses by default before 7.66.0 59 60 Since 7.66.0, libcurl requires this option set to 1L to allow HTTP/0.9 61 responses. 62 63 # %AVAILABILITY% 64 65 # RETURN VALUE 66 67 curl_easy_setopt(3) returns a CURLcode indicating success or error. 68 69 CURLE_OK (0) means everything was OK, non-zero means an error occurred, see 70 libcurl-errors(3).