mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-08-17 04:39:34 +02:00
* Merging revisions r45446 from trunk:
------------------------------------------------------------------------ r45446 | michael | 2020-05-20 11:34:44 +0200 (Wed, 20 May 2020) | 1 line * Add support for SameSite attribute of cookie (bug ID 0037115) ------------------------------------------------------------------------ git-svn-id: branches/fixes_3_2@46588 -
This commit is contained in:
parent
0a2f57724b
commit
9ae60e491c
@ -97,6 +97,7 @@ const
|
|||||||
SCookiePath = httpProtocol.SCookiePath;
|
SCookiePath = httpProtocol.SCookiePath;
|
||||||
SCookieSecure = httpProtocol.SCookieSecure;
|
SCookieSecure = httpProtocol.SCookieSecure;
|
||||||
SCookieHttpOnly = httpProtocol.SCookieHttpOnly;
|
SCookieHttpOnly = httpProtocol.SCookieHttpOnly;
|
||||||
|
SCookieSameSite = httpProtocol.SCookieSameSite;
|
||||||
|
|
||||||
HTTPMonths : array[1..12] of string[3] = (
|
HTTPMonths : array[1..12] of string[3] = (
|
||||||
'Jan', 'Feb', 'Mar', 'Apr',
|
'Jan', 'Feb', 'Mar', 'Apr',
|
||||||
@ -148,11 +149,13 @@ type
|
|||||||
TRequest = Class;
|
TRequest = Class;
|
||||||
|
|
||||||
{ TCookie }
|
{ TCookie }
|
||||||
|
TSameSite = (ssEmpty,ssNone,ssStrict,ssLax);
|
||||||
|
|
||||||
TCookie = class(TCollectionItem)
|
TCookie = class(TCollectionItem)
|
||||||
private
|
private
|
||||||
FHttpOnly: Boolean;
|
FHttpOnly: Boolean;
|
||||||
FName: string;
|
FName: string;
|
||||||
|
FSameSite: TSameSite;
|
||||||
FValue: string;
|
FValue: string;
|
||||||
FPath: string;
|
FPath: string;
|
||||||
FDomain: string;
|
FDomain: string;
|
||||||
@ -171,6 +174,7 @@ type
|
|||||||
property Expires: TDateTime read FExpires write FExpires;
|
property Expires: TDateTime read FExpires write FExpires;
|
||||||
property Secure: Boolean read FSecure write FSecure;
|
property Secure: Boolean read FSecure write FSecure;
|
||||||
property HttpOnly: Boolean read FHttpOnly write FHttpOnly;
|
property HttpOnly: Boolean read FHttpOnly write FHttpOnly;
|
||||||
|
property SameSite: TSameSite Read FSameSite Write FSameSite;
|
||||||
Property AsString : String Read GetAsString;
|
Property AsString : String Read GetAsString;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
@ -2317,6 +2321,10 @@ function TCookie.GetAsString: string;
|
|||||||
Result:=Result+';'+S;
|
Result:=Result+';'+S;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
Const
|
||||||
|
SSameSiteValues : Array[TSameSite] of string
|
||||||
|
= ('','None','Strict','Lax');
|
||||||
|
|
||||||
Var
|
Var
|
||||||
Y,M,D : Word;
|
Y,M,D : Word;
|
||||||
|
|
||||||
@ -2338,6 +2346,8 @@ begin
|
|||||||
AddToResult(SCookieHttpOnly);
|
AddToResult(SCookieHttpOnly);
|
||||||
if FSecure then
|
if FSecure then
|
||||||
AddToResult(SCookieSecure);
|
AddToResult(SCookieSecure);
|
||||||
|
if FSameSite<>ssEmpty then
|
||||||
|
AddToResult(SSameSiteValues[FSameSite]);
|
||||||
except
|
except
|
||||||
{$ifdef cgidebug}
|
{$ifdef cgidebug}
|
||||||
On E : Exception do
|
On E : Exception do
|
||||||
|
@ -87,6 +87,7 @@ Const
|
|||||||
SCookiePath = ' Path=%s';
|
SCookiePath = ' Path=%s';
|
||||||
SCookieSecure = ' Secure';
|
SCookieSecure = ' Secure';
|
||||||
SCookieHttpOnly = ' HttpOnly';
|
SCookieHttpOnly = ' HttpOnly';
|
||||||
|
SCookieSameSite = ' SameSite';
|
||||||
|
|
||||||
HTTPMonths: array[1..12] of string[3] = (
|
HTTPMonths: array[1..12] of string[3] = (
|
||||||
'Jan', 'Feb', 'Mar', 'Apr',
|
'Jan', 'Feb', 'Mar', 'Apr',
|
||||||
|
Loading…
Reference in New Issue
Block a user