diff --git a/websocket-sharp/Net/Cookie.cs b/websocket-sharp/Net/Cookie.cs index 5fd622fe..785300c3 100644 --- a/websocket-sharp/Net/Cookie.cs +++ b/websocket-sharp/Net/Cookie.cs @@ -96,6 +96,7 @@ namespace WebSocketSharp.Net private string _port; private int[] _ports; private static readonly char[] _reservedCharsForValue; + private string _sameSite; private bool _secure; private DateTime _timeStamp; private string _value; @@ -350,6 +351,16 @@ namespace WebSocketSharp.Net } } + internal string SameSite { + get { + return _sameSite; + } + + set { + _sameSite = value; + } + } + #endregion #region Public Properties @@ -768,6 +779,9 @@ namespace WebSocketSharp.Net if (!_domain.IsNullOrEmpty ()) buff.AppendFormat ("; Domain={0}", _domain); + if (!_sameSite.IsNullOrEmpty ()) + buff.AppendFormat ("; SameSite={0}", _sameSite); + if (_secure) buff.Append ("; Secure"); diff --git a/websocket-sharp/Net/CookieCollection.cs b/websocket-sharp/Net/CookieCollection.cs index e5939642..8c0322bd 100644 --- a/websocket-sharp/Net/CookieCollection.cs +++ b/websocket-sharp/Net/CookieCollection.cs @@ -526,6 +526,17 @@ namespace WebSocketSharp.Net continue; } + if (name.Equals ("samesite", caseInsensitive)) { + if (cookie == null) + continue; + + if (val.Length == 0) + continue; + + cookie.SameSite = val.Unquote (); + continue; + } + if (cookie != null) ret.add (cookie);