Internet Direct (Indy) Version 9.0.2 Beta
TIdCookieManager.AddCookie
Adds a cookie to the collection managed by IdCookieManager.

procedure AddCookie(ACookie: String; AHost: String);
Parameters
ACookie: String
Textual Cookie values as described in RFC 2109.

AHost: String
Host name or address from the URI for the HTTP request.

Description
AddCookie is a procedure that creates a new TIdCookieRFC2109 Cookie class instance for the Cookie values specified in ACookie and the Domain specified in AHost. The internal implementation of AddCookie insures that the Cookie is updated to reflect the values in ACookie, and sets the Domain attribute of the Cookie to AHost when no specific Domain is found in the Cookie contents.

AddCookie checks that the Cookie is valid for the Domain specified in AHost prior to signalling the OnNewCookie event handler. When AHost is not a valid Domain, or the OnNewCookie event handler indicates that the Cookie has been rejected, the Cookie class instance is removed from the CookieCollection and freed.