CURLOPT_MAXAGE_CONN.3 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. .\" **************************************************************************
  2. .\" * _ _ ____ _
  3. .\" * Project ___| | | | _ \| |
  4. .\" * / __| | | | |_) | |
  5. .\" * | (__| |_| | _ <| |___
  6. .\" * \___|\___/|_| \_\_____|
  7. .\" *
  8. .\" * Copyright (C) 2019, 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.haxx.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_MAXAGE_CONN 3 "18 Apr 2019" "libcurl 7.65.0" "curl_easy_setopt options"
  24. .SH NAME
  25. CURLOPT_MAXAGE_CONN \- max idle time allowed for reusing a connection
  26. .SH SYNOPSIS
  27. #include <curl/curl.h>
  28. CURLcode curl_easy_setopt(CURL *handle, CURLOPT_MAXAGE_CONN, long maxage);
  29. .SH DESCRIPTION
  30. Pass a long as parameter containing \fImaxage\fP - the maximum time in seconds
  31. that you allow an existing connection to have to be considered for reuse for
  32. this request.
  33. The "connection cache" that holds previously used connections. When a new
  34. request is to be done, it will consider any connection that matches for
  35. reuse. The \fICURLOPT_MAXAGE_CONN(3)\fP limit prevents libcurl from trying
  36. very old connections for reuse, since old connections have a high risk of not
  37. working and thus trying them is a performance loss and sometimes service loss
  38. due to the difficulties to figure out the situation. If a connection is found
  39. in the cache that is older than this set \fImaxage\fP, it will instead be
  40. closed.
  41. .SH DEFAULT
  42. Default maxage is 118 seconds.
  43. .SH PROTOCOLS
  44. All
  45. .SH EXAMPLE
  46. .nf
  47. CURL *curl = curl_easy_init();
  48. if(curl) {
  49. curl_easy_setopt(curl, CURLOPT_URL, "http://example.com");
  50. /* only allow 30 seconds idle time */
  51. curl_easy_setopt(curl, CURLOPT_MAXAGE_CONN, 30L);
  52. curl_easy_perform(curl);
  53. }
  54. .fi
  55. .SH AVAILABILITY
  56. Added in libcurl 7.65.0
  57. .SH RETURN VALUE
  58. Returns CURLE_OK.
  59. .SH "SEE ALSO"
  60. .BR CURLOPT_TIMEOUT "(3), " CURLOPT_FORBID_REUSE "(3), "
  61. .BR CURLOPT_FRESH_CONNECT "(3), "