CURLOPT_NOBODY.3 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 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. .\" * SPDX-License-Identifier: curl
  22. .\" *
  23. .\" **************************************************************************
  24. .\"
  25. .TH CURLOPT_NOBODY 3 "17 Jun 2014" libcurl libcurl
  26. .SH NAME
  27. CURLOPT_NOBODY \- do the download request without getting the body
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_NOBODY, long opt);
  32. .fi
  33. .SH DESCRIPTION
  34. A long parameter set to 1 tells libcurl to not include the body-part in the
  35. output when doing what would otherwise be a download. For HTTP(S), this makes
  36. libcurl do a HEAD request. For most other protocols it means just not asking
  37. to transfer the body data.
  38. For HTTP operations when \fICURLOPT_NOBODY(3)\fP has been set, disabling this
  39. option (with 0) will make it a GET again - only if the method is still set to
  40. be HEAD. The proper way to get back to a GET request is to set
  41. \fICURLOPT_HTTPGET(3)\fP and for other methods, use the POST or UPLOAD
  42. options.
  43. Enabling \fICURLOPT_NOBODY(3)\fP means asking for a download without a body.
  44. If you do a transfer with HTTP that involves a method other than HEAD, you
  45. will get a body (unless the resource and server sends a zero byte body for the
  46. specific URL you request).
  47. .SH DEFAULT
  48. 0, the body is transferred
  49. .SH PROTOCOLS
  50. Most
  51. .SH EXAMPLE
  52. .nf
  53. curl = curl_easy_init();
  54. if(curl) {
  55. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  56. /* get us the resource without a body - use HEAD! */
  57. curl_easy_setopt(curl, CURLOPT_NOBODY, 1L);
  58. /* Perform the request */
  59. curl_easy_perform(curl);
  60. }
  61. .fi
  62. .SH AVAILABILITY
  63. Always
  64. .SH RETURN VALUE
  65. Returns CURLE_OK
  66. .SH "SEE ALSO"
  67. .BR CURLOPT_HTTPGET "(3), " CURLOPT_POSTFIELDS "(3), " CURLOPT_UPLOAD "(3), "
  68. .BR CURLOPT_REQUEST_TARGET "(3), " CURLOPT_MIMEPOST "(3), "