CURLOPT_FORBID_REUSE.3 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. .\" generated by cd2nroff 0.1 from CURLOPT_FORBID_REUSE.md
  2. .TH CURLOPT_FORBID_REUSE 3 "2025-01-17" libcurl
  3. .SH NAME
  4. CURLOPT_FORBID_REUSE \- make connection get closed at once after use
  5. .SH SYNOPSIS
  6. .nf
  7. #include <curl/curl.h>
  8. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_FORBID_REUSE, long close);
  9. .fi
  10. .SH DESCRIPTION
  11. Pass a long. Set \fIclose\fP to 1 to make libcurl explicitly close the
  12. connection when done with the transfer. Normally, libcurl keeps all
  13. connections alive when done with one transfer in case a succeeding one follows
  14. that can reuse them. This option should be used with caution and only if you
  15. understand what it does as it can seriously impact performance.
  16. Set to 0 to have libcurl keep the connection open for possible later reuse
  17. (default behavior).
  18. .SH DEFAULT
  19. 0
  20. .SH PROTOCOLS
  21. This functionality affects all supported protocols
  22. .SH EXAMPLE
  23. .nf
  24. int main(void)
  25. {
  26. CURL *curl = curl_easy_init();
  27. if(curl) {
  28. curl_easy_setopt(curl, CURLOPT_URL, "https://example.com/");
  29. curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1L);
  30. curl_easy_perform(curl);
  31. /* this second transfer may not reuse the same connection */
  32. curl_easy_perform(curl);
  33. curl_easy_cleanup(curl);
  34. }
  35. }
  36. .fi
  37. .SH AVAILABILITY
  38. Added in curl 7.7
  39. .SH RETURN VALUE
  40. Returns CURLE_OK
  41. .SH SEE ALSO
  42. .BR CURLOPT_FRESH_CONNECT (3),
  43. .BR CURLOPT_MAXCONNECTS (3),
  44. .BR CURLOPT_MAXLIFETIME_CONN (3)