curl_easy_cleanup.3 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. .\" generated by cd2nroff 0.1 from curl_easy_cleanup.md
  2. .TH curl_easy_cleanup 3 "2025-01-17" libcurl
  3. .SH NAME
  4. curl_easy_cleanup \- free an easy handle
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. void curl_easy_cleanup(CURL *handle);
  9. .fi
  10. .SH DESCRIPTION
  11. This function is the opposite of \fIcurl_easy_init(3)\fP. It closes down and frees
  12. all resources previously associated with this easy handle.
  13. This call closes all connections this handle has used and possibly has kept
  14. open until now unless the easy handle was attached to a multi handle while
  15. doing the transfers. Do not call this function if you intend to transfer more
  16. files, reusing handles is a key to good performance with libcurl.
  17. Occasionally you may get your progress callback or header callback called from
  18. within \fIcurl_easy_cleanup(3)\fP (if previously set for the handle using
  19. \fIcurl_easy_setopt(3)\fP). Like if libcurl decides to shut down the connection and
  20. the protocol is of a kind that requires a command/response sequence before
  21. disconnect. Examples of such protocols are FTP, POP3 and IMAP.
  22. Any use of the easy \fBhandle\fP after this function has been called and have
  23. returned, is illegal.
  24. To close an easy handle that has been used with the multi interface, make sure
  25. to first call \fIcurl_multi_remove_handle(3)\fP to remove it from the multi handle
  26. before it is closed.
  27. Passing in a NULL pointer in \fIhandle\fP makes this function return immediately
  28. with no action.
  29. .SH PROTOCOLS
  30. This functionality affects all supported protocols
  31. .SH EXAMPLE
  32. .nf
  33. int main(void)
  34. {
  35. CURL *curl = curl_easy_init();
  36. if(curl) {
  37. CURLcode res;
  38. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com");
  39. res = curl_easy_perform(curl);
  40. if(res)
  41. printf("error: %s\\n", curl_easy_strerror(res));
  42. curl_easy_cleanup(curl);
  43. }
  44. }
  45. .fi
  46. .SH AVAILABILITY
  47. Added in curl 7.1
  48. .SH RETURN VALUE
  49. None
  50. .SH SEE ALSO
  51. .BR curl_easy_duphandle (3),
  52. .BR curl_easy_init (3),
  53. .BR curl_easy_reset (3),
  54. .BR curl_multi_cleanup (3),
  55. .BR curl_multi_remove_handle (3)