2014-06-18 06:29:22 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\" * _ _ ____ _
|
|
|
|
.\" * Project ___| | | | _ \| |
|
|
|
|
.\" * / __| | | | |_) | |
|
|
|
|
.\" * | (__| |_| | _ <| |___
|
|
|
|
.\" * \___|\___/|_| \_\_____|
|
|
|
|
.\" *
|
2023-01-02 20:51:48 +08:00
|
|
|
.\" * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
2014-06-18 06:29:22 +08:00
|
|
|
.\" *
|
|
|
|
.\" * This software is licensed as described in the file COPYING, which
|
|
|
|
.\" * you should have received as part of this distribution. The terms
|
2020-11-04 21:02:01 +08:00
|
|
|
.\" * are also available at https://curl.se/docs/copyright.html.
|
2014-06-18 06:29:22 +08:00
|
|
|
.\" *
|
|
|
|
.\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
|
|
|
.\" * copies of the Software, and permit persons to whom the Software is
|
|
|
|
.\" * furnished to do so, under the terms of the COPYING file.
|
|
|
|
.\" *
|
|
|
|
.\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
|
|
|
.\" * KIND, either express or implied.
|
|
|
|
.\" *
|
|
|
|
.\" * SPDX-License-Identifier: curl
|
2022-05-17 17:16:50 +08:00
|
|
|
.\" *
|
2014-06-18 06:29:22 +08:00
|
|
|
.\" **************************************************************************
|
|
|
|
.\"
|
2023-04-26 14:58:35 +08:00
|
|
|
.TH CURLOPT_NOBODY 3 "17 Jun 2014" libcurl libcurl
|
2014-06-18 06:29:22 +08:00
|
|
|
.SH NAME
|
2014-08-28 05:59:54 +08:00
|
|
|
CURLOPT_NOBODY \- do the download request without getting the body
|
2014-06-18 06:29:22 +08:00
|
|
|
.SH SYNOPSIS
|
2021-11-26 21:20:18 +08:00
|
|
|
.nf
|
2014-06-18 06:29:22 +08:00
|
|
|
#include <curl/curl.h>
|
|
|
|
|
|
|
|
CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt);
|
2021-11-26 21:20:18 +08:00
|
|
|
.fi
|
2014-06-18 06:29:22 +08:00
|
|
|
.SH DESCRIPTION
|
|
|
|
A long parameter set to 1 tells libcurl to not include the body-part in the
|
2014-08-28 05:59:54 +08:00
|
|
|
output when doing what would otherwise be a download. For HTTP(S), this makes
|
|
|
|
libcurl do a HEAD request. For most other protocols it means just not asking
|
|
|
|
to transfer the body data.
|
|
|
|
|
2022-09-21 05:30:19 +08:00
|
|
|
For HTTP operations when \fICURLOPT_NOBODY(3)\fP has been set, disabling this
|
2020-07-27 17:54:29 +08:00
|
|
|
option (with 0) will make it a GET again - only if the method is still set to
|
|
|
|
be HEAD. The proper way to get back to a GET request is to set
|
2020-10-17 05:01:55 +08:00
|
|
|
\fICURLOPT_HTTPGET(3)\fP and for other methods, use the POST or UPLOAD
|
2020-07-27 17:54:29 +08:00
|
|
|
options.
|
|
|
|
|
2020-07-28 05:59:00 +08:00
|
|
|
Enabling \fICURLOPT_NOBODY(3)\fP means asking for a download without a body.
|
2020-07-27 17:54:29 +08:00
|
|
|
|
|
|
|
If you do a transfer with HTTP that involves a method other than HEAD, you
|
|
|
|
will get a body (unless the resource and server sends a zero byte body for the
|
|
|
|
specific URL you request).
|
2014-06-18 06:29:22 +08:00
|
|
|
.SH DEFAULT
|
|
|
|
0, the body is transferred
|
|
|
|
.SH PROTOCOLS
|
|
|
|
Most
|
|
|
|
.SH EXAMPLE
|
2014-10-21 14:58:03 +08:00
|
|
|
.nf
|
|
|
|
curl = curl_easy_init();
|
|
|
|
if(curl) {
|
2020-07-27 17:54:29 +08:00
|
|
|
curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
|
2014-10-21 14:58:03 +08:00
|
|
|
|
2020-07-27 17:54:29 +08:00
|
|
|
/* get us the resource without a body - use HEAD! */
|
2014-10-21 14:58:03 +08:00
|
|
|
curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
|
|
|
|
|
2017-06-19 20:10:33 +08:00
|
|
|
/* Perform the request */
|
2014-10-21 14:58:03 +08:00
|
|
|
curl_easy_perform(curl);
|
|
|
|
}
|
|
|
|
.fi
|
2014-06-18 06:29:22 +08:00
|
|
|
.SH AVAILABILITY
|
|
|
|
Always
|
|
|
|
.SH RETURN VALUE
|
|
|
|
Returns CURLE_OK
|
|
|
|
.SH "SEE ALSO"
|
2020-07-27 17:54:29 +08:00
|
|
|
.BR CURLOPT_HTTPGET "(3), " CURLOPT_POSTFIELDS "(3), " CURLOPT_UPLOAD "(3), "
|
|
|
|
.BR CURLOPT_REQUEST_TARGET "(3), " CURLOPT_MIMEPOST "(3), "
|