CURLOPT_NOBODY.3 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2021, Daniel Stenberg, <daniel@haxx.se>, et al.
  9. .\" *
  10. .\" * This software is licensed as described in the file COPYING, which
  11. .\" * you should have received as part of this distribution. The terms
  12. .\" * are also available at https://curl.se/docs/copyright.html.
  13. .\" *
  14. .\" * You may opt to use, copy, modify, merge, publish, distribute and/or sell
  15. .\" * copies of the Software, and permit persons to whom the Software is
  16. .\" * furnished to do so, under the terms of the COPYING file.
  17. .\" *
  18. .\" * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
  19. .\" * KIND, either express or implied.
  20. .\" *
  21. .\" **************************************************************************
  22. .\"
  23. .TH CURLOPT_NOBODY 3 "17 Jun 2014" "libcurl 7.37.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_NOBODY \- do the download request without getting the body
  26. .SH SYNOPSIS
  27. .nf
  28. #include <curl/curl.h>
  29. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt);
  30. .fi
  31. .SH DESCRIPTION
  32. A long parameter set to 1 tells libcurl to not include the body-part in the
  33. output when doing what would otherwise be a download. For HTTP(S), this makes
  34. libcurl do a HEAD request. For most other protocols it means just not asking
  35. to transfer the body data.
  36. For HTTP operations when \fICURLOPT_NOBODY(3)\fP has been set, unsetting the
  37. option (with 0) will make it a GET again - only if the method is still set to
  38. be HEAD. The proper way to get back to a GET request is to set
  39. \fICURLOPT_HTTPGET(3)\fP and for other methods, use the POST or UPLOAD
  40. options.
  41. Enabling \fICURLOPT_NOBODY(3)\fP means asking for a download without a body.
  42. If you do a transfer with HTTP that involves a method other than HEAD, you
  43. will get a body (unless the resource and server sends a zero byte body for the
  44. specific URL you request).
  45. .SH DEFAULT
  46. 0, the body is transferred
  47. .SH PROTOCOLS
  48. Most
  49. .SH EXAMPLE
  50. .nf
  51. curl = curl_easy_init();
  52. if(curl) {
  53. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  54. /* get us the resource without a body - use HEAD! */
  55. curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
  56. /* Perform the request */
  57. curl_easy_perform(curl);
  58. }
  59. .fi
  60. .SH AVAILABILITY
  61. Always
  62. .SH RETURN VALUE
  63. Returns CURLE_OK
  64. .SH "SEE ALSO"
  65. .BR CURLOPT_HTTPGET "(3), " CURLOPT_POSTFIELDS "(3), " CURLOPT_UPLOAD "(3), "
  66. .BR CURLOPT_REQUEST_TARGET "(3), " CURLOPT_MIMEPOST "(3), "