curl_easy_cleanup.3 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 1998 - 2022, 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 curl_easy_cleanup 3 "22 Aug 2007" "libcurl 7.17.0" "libcurl Manual"
  26. .SH NAME
  27. curl_easy_cleanup - End a libcurl easy handle
  28. .SH SYNOPSIS
  29. .nf
  30. #include <curl/curl.h>
  31. void curl_easy_cleanup(CURL *handle);
  32. .fi
  33. .SH DESCRIPTION
  34. This function must be the last function to call for an easy session. It is the
  35. opposite of the \fIcurl_easy_init(3)\fP function and must be called with the
  36. same \fIhandle\fP as input that a \fIcurl_easy_init(3)\fP call returned.
  37. This might close all connections this handle has used and possibly has kept
  38. open until now - unless it was attached to a multi handle while doing the
  39. transfers. Do not call this function if you intend to transfer more files,
  40. re-using handles is a key to good performance with libcurl.
  41. Occasionally you may get your progress callback or header callback called from
  42. within \fIcurl_easy_cleanup(3)\fP (if previously set for the handle using
  43. \fIcurl_easy_setopt(3)\fP). Like if libcurl decides to shut down the
  44. connection and the protocol is of a kind that requires a command/response
  45. sequence before disconnect. Examples of such protocols are FTP, POP3 and IMAP.
  46. Any use of the \fBhandle\fP after this function has been called and have
  47. returned, is illegal. \fIcurl_easy_cleanup(3)\fP kills the handle and all
  48. memory associated with it!
  49. To close an easy handle that has been used with the multi interface, make sure
  50. to call \fIcurl_multi_remove_handle(3)\fP first to remove it from the multi
  51. handle before it is closed.
  52. Passing in a NULL pointer in \fIhandle\fP will make this function return
  53. immediately with no action.
  54. .SH EXAMPLE
  55. .nf
  56. CURL *curl = curl_easy_init();
  57. if(curl) {
  58. CURLcode res;
  59. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  60. res = curl_easy_perform(curl);
  61. curl_easy_cleanup(curl);
  62. }
  63. .fi
  64. .SH AVAILABILITY
  65. Added in 7.1
  66. .SH RETURN VALUE
  67. None
  68. .SH "SEE ALSO"
  69. .BR curl_easy_init "(3), " curl_easy_duphandle "(3), "
  70. .BR curl_easy_reset "(3), "
  71. .BR curl_multi_cleanup "(3), " curl_multi_remove_handle "(3) "