Skip to content

libcURL.CookieEngine

Andrew Lambert edited this page Jan 14, 2023 · 28 revisions

libcURL.CookieEngine

Class Declaration

 Protected Class CookieEngine

Remarks

This class presents an interface to libcURL's cookie management subsystem (the "cookie engine"). Each instance of EasyHandle has its own cookie engine. To share cookies among several EasyHandles, refer to the ShareHandle class.

The cookie engine works much like that in a web browser: automatically collecting cookies when they are received, inserting them into subsequent requests when appropriate, and deleting them when they expire or a new session is begun. The cookie engine indexes cookies by name and domain. Cookies are only sent if the remote host matches the domain.

You may add/update cookies by calling the SetCookie method. Existing cookies with the same name and domain are overwritten.

You should always specify a domain name when setting cookies, especially if you are connecting to multiple domains. Cookies without a domain ("") will be sent to all hosts, will not be updated if a website uses the Set-Cookie: header, and will be sent in addition to any same-named cookies which do specify a domain.

Cookies may have an explicit expiration date; those without one expire at the end of the session. Expired cookies are discarded by the cookie engine; to delete a specific cookie you may change its expiration date to a point in the past (Note: 1/1/1970 00:00:00 GMT is the earliest valid expiration date.)

The cookie engine can optionally load and store cookies in a text file (Netscape cookiejar format).

Methods

Properties

See also

Clone this wiki locally