понедельник, 22 августа 2016 г.

functionGetLastValueOf(const AName:String;var VValue:String):Boolean;var
I:Integer;beginResult:=False;for I := CookieProp.Count-1downto0dobeginif TextIsSame(CookieProp.Names[I], AName) thenbegin{$IFDEF HAS_TStrings_ValueFromIndex}
VValue := CookieProp.ValueFromIndex[I];{$ELSE}
VValue :=Copy(CookieProp[I],Pos('=', CookieProp[I])+1, MaxInt);{Do not Localize}{$ENDIF}Result:=True;Exit;end;end;end;...if GetLastValueOf('MAX-AGE', S) thenbegin{Do not Localize}
FPersistent :=True;
FExpires :=StrToFloat(S);endelseif GetLastValueOf('EXPIRES', S) then{Do not Localize}begin
FPersistent :=True;
FExpires :=StrToFloat(S);endelsebegin
FPersistent :=False;
FExpires :=EncodeDate(9999,12,31) +EncodeTime(23,59,59,999);end;if GetLastValueOf('DOMAIN', S)then{Do not Localize}begin{ If the user agent is configured to reject "public suffixes" and the domain-attribute is a public suffix: If the domain-attribute is identical to the canonicalized request-host: Let the domain-attribute be the empty string. Otherwise: Ignore the cookie entirely and abort these steps. NOTE: A "public suffix" is a domain that is controlled by a public registry, such as "com", "co.uk", and "pvt.k12.wy.us". This step is essential for preventing attacker.com from disrupting the integrity of example.com by setting a cookie with a Domain attribute of "com". Unfortunately, the set of public suffixes (also known as "registry controlled domains") changes over time. If feasible, user agents SHOULD use an up-to-date public suffix list, such as the one maintained by the Mozilla project at <http://publicsuffix.org/>. }end;ifLength(S) >0thenbeginifnot IsDomainMatch(AURI.Host, S) thenbeginExit;end;
FHostOnly :=False;
FDomain := S;endelsebegin
FHostOnly :=True;
FDomain := CanonicalizeHostName(AURI.Host);end;