Repository navigation
SSL Sessions
SSL session data can be exported and imported to enable resumption across transfers or script executions. This reduces TLS handshake overhead on subsequent connections to the same server.
SSL session sharing requires a share handle configured for the SSL_SESSION type:
share_handle := curl.ShareInit()
curl.ShareSetOpt("SHARE", "SSL_SESSION", share_handle)As an alternative, if you don't want to manage an entire instance, you can use the default share_handle:
share_handle := curl.shareHandleMap[0][1]The share handle must be attached to an easy handle before any transfer that should participate in session resumption:
curl.SetOpt("SHARE", share_handle)After a successful TLS transfer, call ExportSSLs() on the active easy handle. It returns an array of serialized session objects containing handshake state and credentials:
sslObj := curl.ExportSSLs()This data can be serialized to JSON for storage across script runs:
sslJson := JSON.Dump(sslObj)
FileOpen("ssl_cache.json", "w").Write(sslJson)Before performing a transfer on a target server, import previously saved sessions to accelerate the TLS handshake:
raw := FileOpen("ssl_cache.json", "r").Read()
sslObj := JSON.Load(raw)
; Applies saved sessions to the active easy handle
curl.ImportSSLs(sslObj)
curl.SetOpt("URL", "https://example.com")
curl.Sync()- Sessions are bound to the specific server hostname and port. Importing sessions from an unrelated domain is safely ignored by libcurl.
-
ExportSSLscaptures state immediately after a transfer completes. Calling it before any TLS activity returns an empty array. - The underlying export callback plumbing is handled internally. You interact solely with the top-level import/export API.
- Debug and Diagnostics — version info, timestamps, and logging
- Easy Handle Reference — full method list
Foundations
Operations
- Download Modes
- Setting and Listing Options
- Setting and Inspecting Headers
- POST and Upload
- Multiple Easy Handles
- Async and Multi Interface
- URL Construction
- Share Interface
- MIME and Multipart
- Raw Send and Receive
- Pause and Resume
- WebSocket
- SSL Sessions
- Debug and Diagnostics
API Reference
- Easy Handle Reference
- Multi Handle Reference
- Share Handle Reference
- MIME Handle Reference
- URL Handle Reference
- Utility Methods Reference
- WebSocket Reference
Code Snippets