TIdCookieManager
has a public CookieCollection
property of type TIdCookies
which provides access to the actual cookies. The cookies of one TIdCookies
can be directly copied to another TIdCookies
via its Assign()
or AddCookies()
method, eg:
// clears the dest collection before then copying cookies to it...
CookieMgrInWorkerThread.CookieCollection.Assign(CookieMgrInMainThread.CookieCollection);
// does not clear the dest collection before copying cookies to it...
CookieMgrInWorkerThread.CookieCollection.AddCookies(CookieMgrInMainThread.CookieCollection);
Either way, TIdCookies
is thread-safe, as it uses an internal TMultiReadExclusiveWriteSynchronizer
during read/write operations.