Caches and state
When libcurl is used for Internet transfers, it stores data in caches andstate storage in order to do subsequent transfers faster and better.
The caches are kept associated with theCURL
orCURLM
handles, dependingon which libcurl API is used, easy or multi.
DNS cache
When libcurl resolves the IP addresses of a hostname it stores the result inits DNS cache (with a default life-time of 60 seconds), so that subsequentlookups can use the cached data immediately instead of doing the (potentiallyslow) resolve operation again. This cache exists in memory only.
connection cache
Also known as the connection pool. This is where curl puts live connectionsafter a transfer is complete so that a subsequent transfer might be able touse an already existing connection instead of having to set a new one up. Whena connection is reused, curl avoids name lookups, TLS handshakes and more.This cache exists in memory only.
TLS session-ID cache
When curl uses TLS, it saves thesession-ID in a cache. When a subsequenttransfer needs to redo the TLS handshake with a host for which it has a cachedsession-ID, the handshake can complete faster. This cache exists in memoryonly.
CA store cache
When curl creates a new connection and performs a TLS handshake, it needs toload and parse aCA store to use for verifying the certificate presented bythe remote server. The CA store cache keeps the parsed CA store in memory fora period of time (default is 24 hours) so that subsequent handshakes are donemuch faster by avoiding having to re-parse this potentially large dataamount. This cache exists in memory only. Added in 7.87.0.
HSTS
HSTS is HTTP Strict Transport Security. HTTPS servers can inform clients thatthey want the client to connect to its hostname using only HTTPS going forwardand not HTTP, even whenHTTP://
URLs are used. curl keeps this connectionupgrade information in memory and can be told to load it from and save it todisk as well.
Alt-Svc
Alt-Svc:
is an HTTP response header that informs the client aboutalternative hostnames, port numbers and protocol versions where the sameservice is also available. curl keeps this alternative service information inmemory and can be told to load it from and save it to disk as well.
Cookies
Cookies are name value pairs sent from an HTTP server to the client, meant tobe sent back in subsequent requests that match the conditions. curl keeps allcookies in memory and can be told to load them from and save them to disk aswell.