Bug in TIdNetscapeCookie.Assign: should use Original CookieText

Giganews Newsgroups
Subject: Bug in TIdNetscapeCookie.Assign: should use Original CookieText
Posted by:  Andreas Hesse (…@ahsysteme.de)
Date: Thu, 10 Jan 2008

The Assign should use the Original CookieText of the Cookie, not the
modified Text by GetCookieText (it removes the expires value).

// Old Source
procedure TIdNetscapeCookie.Assign(Source: TPersistent);
begin
  if Source is TIdCookieRFC2109 then
  begin
    CookieText := TIdCookieRFC2109(Source).CookieText;
    FInternalVersion := TIdCookieRFC2109(Source).FInternalVersion;
  end else begin
    inherited Assign(Source);
  end;
end;

// Fixed Source
procedure TIdNetscapeCookie.Assign(Source: TPersistent);
begin
  if Source is TIdCookieRFC2109 then
  begin
    CookieText := TIdCookieRFC2109(Source).FCookieText;
    FInternalVersion := TIdCookieRFC2109(Source).FInternalVersion;
  end else begin
    inherited Assign(Source);
  end;
end;

And I would like to have a property OrgCookieText: string read
FCookieText;
Main reason is for logging any CookieText Changes.

Andreas

Replies