Internet Direct (Indy) Version 9.0.2 Beta
TIdCookies.AddCookie
Adds or updates a Cookie instance in the collection.

procedure AddCookie(ACookie: TIdCookieRFC2109);
Parameters
ACookie: TIdCookieRFC2109
Cookie class instance to be added or updated in the collection.

Description
AddCookie is a procedure that adds a TIdCookieRFC2109 class instance specified in ACookie to the Cookie collection. AddCookie uses an instance of TIdCookieList to maintain a list of Cookies for the Domain specified in ACookie. AddCookie also uses CookieListByDomain to create or maintain Cookie class instances using the value of CookieName specified in ACookie.

If a Cookie having the Domain and CookieName specified in ACookie already exists in the collection, the Cookie value is assigned to the existing TIdCookieRFC2109 object instance and ACookie is freed. Otherwise, ACookie is added to the Cookie list for the specified Domain and CookieName.

AddCookie is called by TIdCookieManager when a Cookie is added to the collection maintained by an HTTP client.