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

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

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

Description
AddCookie2 is a procedure that creates a new TIdCookieRFC2965 Cookie class instance for the Cookie values specified in ACookie and the Domain specified in AHost. The internal implementation of AddCookie2 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.

AddCookie2 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.