Re: Bug in TIdNetscapeCookie.Assign: should use Original CookieText

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

Need a little bit more investigation. The Domain must be set (see above).
There should be a better solution to Assign one Cookie to another.

> 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;
      Domain := TIdCookieRFC2109(Source).Domain;
>    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

In response to

Bug in TIdNetscapeCookie.Assign: should use Original CookieText posted by Andreas Hesse on Thu, 10 Jan 2008