1CURLOPT_NOBODY(3)          curl_easy_setopt options          CURLOPT_NOBODY(3)
2
3
4

NAME

6       CURLOPT_NOBODY - do the download request without getting the body
7

SYNOPSIS

9       #include <curl/curl.h>
10
11       CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt);
12

DESCRIPTION

14       A long parameter set to 1 tells libcurl to not include the body-part in
15       the output when doing what would otherwise be a download. For  HTTP(S),
16       this makes libcurl do a HEAD request. For most other protocols it means
17       just not asking to transfer the body data.
18
19       For HTTP operations when CURLOPT_NOBODY(3) has been set, unsetting  the
20       option  (with 0) will make it a GET again - only if the method is still
21       set to be HEAD. The proper way to get back to a GET request is  to  set
22       CURLOPT_HTTPGET(3)  and  for  other methods, use the POST or UPLOAD op‐
23       tions.
24
25       Enabling CURLOPT_NOBODY(3) means asking for a download without a body.
26
27       If you do a transfer with HTTP that involves a method other than  HEAD,
28       you  will  get a body (unless the resource and server sends a zero byte
29       body for the specific URL you request).
30

DEFAULT

32       0, the body is transferred
33

PROTOCOLS

35       Most
36

EXAMPLE

38       curl = curl_easy_init();
39       if(curl) {
40         curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
41
42         /* get us the resource without a body - use HEAD! */
43         curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
44
45         /* Perform the request */
46         curl_easy_perform(curl);
47       }
48

AVAILABILITY

50       Always
51

RETURN VALUE

53       Returns CURLE_OK
54

SEE ALSO

56       CURLOPT_HTTPGET(3),  CURLOPT_POSTFIELDS(3),   CURLOPT_UPLOAD(3),   CUR‐
57       LOPT_REQUEST_TARGET(3), CURLOPT_MIMEPOST(3),
58
59
60
61libcurl 7.76.1                 November 04, 2020             CURLOPT_NOBODY(3)
Impressum