cURL / Mailing Lists / curl-library / Single Mail


Re: Using Libcurl With Smart Cards / Maintaining TLS Session ID

From: Nick Zitzmann <>
Date: Mon, 27 Jan 2014 19:20:41 -0600

On Jan 27, 2014, at 5:04 PM, Joel Odom <> wrote:

> I do come with a question. Every time that I make a new request
> (using HTTPS), libcurl renegotiates the TLS connection. When client
> credentials are used, this causes the Windows certificate selection
> dialog to open every time (thanks to my changes). What is the trick
> to make libcurl save a session so that it can use the abbreviated TLS
> handshake?

1. Use the multi API, or
2. Create a share object (CURLSH), set CURLSHOPT_SHARED to CURL_LOCK_DATA_SSL_SESSION, and set the easy handle to use the share object. Donít forget to set the lock/unlock functions for the share object.

Also, if CURLOPT_SSL_SESSIONID_CACHE is set to 0L in your easy handle, it doesnít matter what you do; sessions will never be re-used. Make sure this is set to 1L unless you have a good reason for not wanting to re-use sessions. I think itís 1L by default.

Nick Zitzmann

List admin:
Received on 2014-01-28