[Modify] For the SameSite attribute

This commit is contained in:
sta 2019-06-06 21:05:58 +09:00
parent cd5a602c8f
commit b27b8ee742
2 changed files with 25 additions and 0 deletions

View File

@ -96,6 +96,7 @@ namespace WebSocketSharp.Net
private string _port; private string _port;
private int[] _ports; private int[] _ports;
private static readonly char[] _reservedCharsForValue; private static readonly char[] _reservedCharsForValue;
private string _sameSite;
private bool _secure; private bool _secure;
private DateTime _timeStamp; private DateTime _timeStamp;
private string _value; private string _value;
@ -350,6 +351,16 @@ namespace WebSocketSharp.Net
} }
} }
internal string SameSite {
get {
return _sameSite;
}
set {
_sameSite = value;
}
}
#endregion #endregion
#region Public Properties #region Public Properties
@ -768,6 +779,9 @@ namespace WebSocketSharp.Net
if (!_domain.IsNullOrEmpty ()) if (!_domain.IsNullOrEmpty ())
buff.AppendFormat ("; Domain={0}", _domain); buff.AppendFormat ("; Domain={0}", _domain);
if (!_sameSite.IsNullOrEmpty ())
buff.AppendFormat ("; SameSite={0}", _sameSite);
if (_secure) if (_secure)
buff.Append ("; Secure"); buff.Append ("; Secure");

View File

@ -526,6 +526,17 @@ namespace WebSocketSharp.Net
continue; continue;
} }
if (name.Equals ("samesite", caseInsensitive)) {
if (cookie == null)
continue;
if (val.Length == 0)
continue;
cookie.SameSite = val.Unquote ();
continue;
}
if (cookie != null) if (cookie != null)
ret.add (cookie); ret.add (cookie);