Dear, yes this options are valid, but they do not solve every scenario. Consider the following:
Having a long poll loop in on thread (connection reuse, ssl ticket reuse) Another thread doing some log pumping to a rest API (can send 1 or more requests) - should reuse only SSL ticket id and create new connection, persist connection for this session and once done disconnect. So what the lib is missing is here you have a shared object but use only SSL ticket Or having an option on curl object to do something like easy_close_current_connection(curl obj) Also this would be ok as if we leave maxage to 118sec and use connection cache, the connection does not get closed until next curl operation is done, which can be 1 hour away. And my understanding is that this max age connection will not disconnect as there is no housekeeping after the 118s, meaning that we will be connected to the server until next operation. So for this reasons something like easy_close_current_connection(curl obj) would be perfect. Or adding a function check for max age connections, which we can manually call to do housekeeping. We solved for now like this: - shared object shares only ssl session id - long poll thread reuses the same curl handle (this preserves the connection) - other threads dispose curl object on finish of a session p.s. also extracting SSL session and loading it into shared object would come in handy... BR, Alen On Fri, 13 Nov 2020 at 13:46, Daniel Stenberg <dan...@haxx.se> wrote: > On Fri, 13 Nov 2020, Alen Loncaric via curl-library wrote: > > > The problem is that for this rest calls connections are also added to > > connection cache. Is there a way to prevent this ? > > You can set CURLOPT_FRESH_CONNECT to prevent a new transfer from re-using > any > existing previous connection and CURLOPT_FORBID_REUSE can be set to > prevent > the new transfer's connection to be put into the connection pool for later > re-use by others. > > -- > > / daniel.haxx.se > | Commercial curl support up to 24x7 is available! > | Private help, bug fixes, support, ports, new features > | https://www.wolfssl.com/contact/ >
------------------------------------------------------------------- Unsubscribe: https://cool.haxx.se/list/listinfo/curl-library Etiquette: https://curl.haxx.se/mail/etiquette.html