570 lines
22 KiB
C#
570 lines
22 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Globalization;
|
|
using System.Text;
|
|
|
|
namespace System.Net
|
|
{
|
|
/// <summary>Provides a set of properties and methods that are used to manage cookies. This class cannot be inherited.</summary>
|
|
// Token: 0x02000205 RID: 517
|
|
[Serializable]
|
|
public sealed class Cookie
|
|
{
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class.</summary>
|
|
// Token: 0x0600116E RID: 4462 RVA: 0x00033418 File Offset: 0x00031618
|
|
public Cookie()
|
|
{
|
|
this.expires = DateTime.MinValue;
|
|
this.timestamp = DateTime.Now;
|
|
this.domain = string.Empty;
|
|
this.name = string.Empty;
|
|
this.val = string.Empty;
|
|
this.comment = string.Empty;
|
|
this.port = string.Empty;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" /> and <see cref="P:System.Net.Cookie.Value" />.</summary>
|
|
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
|
|
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
|
|
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character. </exception>
|
|
// Token: 0x0600116F RID: 4463 RVA: 0x00033478 File Offset: 0x00031678
|
|
public Cookie(string name, string value)
|
|
: this()
|
|
{
|
|
this.Name = name;
|
|
this.Value = value;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, and <see cref="P:System.Net.Cookie.Path" />.</summary>
|
|
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
|
|
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
|
|
/// <param name="path">The subset of URIs on the origin server to which this <see cref="T:System.Net.Cookie" /> applies. The default value is "/". </param>
|
|
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character.</exception>
|
|
// Token: 0x06001170 RID: 4464 RVA: 0x00033490 File Offset: 0x00031690
|
|
public Cookie(string name, string value, string path)
|
|
: this(name, value)
|
|
{
|
|
this.Path = path;
|
|
}
|
|
|
|
/// <summary>Initializes a new instance of the <see cref="T:System.Net.Cookie" /> class with a specified <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, <see cref="P:System.Net.Cookie.Path" />, and <see cref="P:System.Net.Cookie.Domain" />.</summary>
|
|
/// <param name="name">The name of a <see cref="T:System.Net.Cookie" />. The following characters must not be used inside <paramref name="name" />: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character. </param>
|
|
/// <param name="value">The value of a <see cref="T:System.Net.Cookie" /> object. The following characters must not be used inside <paramref name="value" />: semicolon, comma. </param>
|
|
/// <param name="path">The subset of URIs on the origin server to which this <see cref="T:System.Net.Cookie" /> applies. The default value is "/". </param>
|
|
/// <param name="domain">The optional internet domain for which this <see cref="T:System.Net.Cookie" /> is valid. The default value is the host this <see cref="T:System.Net.Cookie" /> has been received from. </param>
|
|
/// <exception cref="T:System.Net.CookieException">The <paramref name="name" /> parameter is null. -or- The <paramref name="name" /> parameter is of zero length. -or- The <paramref name="name" /> parameter contains an invalid character.-or- The <paramref name="value" /> parameter is null .-or - The <paramref name="value" /> parameter contains a string not enclosed in quotes that contains an invalid character.</exception>
|
|
// Token: 0x06001171 RID: 4465 RVA: 0x000334A4 File Offset: 0x000316A4
|
|
public Cookie(string name, string value, string path, string domain)
|
|
: this(name, value, path)
|
|
{
|
|
this.Domain = domain;
|
|
}
|
|
|
|
/// <summary>Gets or sets a comment that the server can add to a <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>An optional comment to document intended usage for this <see cref="T:System.Net.Cookie" />.</returns>
|
|
// Token: 0x170005B8 RID: 1464
|
|
// (get) Token: 0x06001173 RID: 4467 RVA: 0x000334F0 File Offset: 0x000316F0
|
|
// (set) Token: 0x06001174 RID: 4468 RVA: 0x000334F8 File Offset: 0x000316F8
|
|
public string Comment
|
|
{
|
|
get
|
|
{
|
|
return this.comment;
|
|
}
|
|
set
|
|
{
|
|
this.comment = ((value != null) ? value : string.Empty);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets a URI comment that the server can provide with a <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>An optional comment that represents the intended usage of the URI reference for this <see cref="T:System.Net.Cookie" />. The value must conform to URI format.</returns>
|
|
// Token: 0x170005B9 RID: 1465
|
|
// (get) Token: 0x06001175 RID: 4469 RVA: 0x00033514 File Offset: 0x00031714
|
|
// (set) Token: 0x06001176 RID: 4470 RVA: 0x0003351C File Offset: 0x0003171C
|
|
public global::System.Uri CommentUri
|
|
{
|
|
get
|
|
{
|
|
return this.commentUri;
|
|
}
|
|
set
|
|
{
|
|
this.commentUri = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the discard flag set by the server.</summary>
|
|
/// <returns>true if the client is to discard the <see cref="T:System.Net.Cookie" /> at the end of the current session; otherwise, false. The default is false.</returns>
|
|
// Token: 0x170005BA RID: 1466
|
|
// (get) Token: 0x06001177 RID: 4471 RVA: 0x00033528 File Offset: 0x00031728
|
|
// (set) Token: 0x06001178 RID: 4472 RVA: 0x00033530 File Offset: 0x00031730
|
|
public bool Discard
|
|
{
|
|
get
|
|
{
|
|
return this.discard;
|
|
}
|
|
set
|
|
{
|
|
this.discard = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the URI for which the <see cref="T:System.Net.Cookie" /> is valid.</summary>
|
|
/// <returns>The URI for which the <see cref="T:System.Net.Cookie" /> is valid.</returns>
|
|
// Token: 0x170005BB RID: 1467
|
|
// (get) Token: 0x06001179 RID: 4473 RVA: 0x0003353C File Offset: 0x0003173C
|
|
// (set) Token: 0x0600117A RID: 4474 RVA: 0x00033544 File Offset: 0x00031744
|
|
public string Domain
|
|
{
|
|
get
|
|
{
|
|
return this.domain;
|
|
}
|
|
set
|
|
{
|
|
if (Cookie.IsNullOrEmpty(value))
|
|
{
|
|
this.domain = string.Empty;
|
|
this.ExactDomain = true;
|
|
}
|
|
else
|
|
{
|
|
this.domain = value;
|
|
this.ExactDomain = value[0] != '.';
|
|
}
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005BC RID: 1468
|
|
// (get) Token: 0x0600117B RID: 4475 RVA: 0x00033590 File Offset: 0x00031790
|
|
// (set) Token: 0x0600117C RID: 4476 RVA: 0x00033598 File Offset: 0x00031798
|
|
internal bool ExactDomain
|
|
{
|
|
get
|
|
{
|
|
return this.exact_domain;
|
|
}
|
|
set
|
|
{
|
|
this.exact_domain = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the current state of the <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>true if the <see cref="T:System.Net.Cookie" /> has expired; otherwise, false. The default is false.</returns>
|
|
// Token: 0x170005BD RID: 1469
|
|
// (get) Token: 0x0600117D RID: 4477 RVA: 0x000335A4 File Offset: 0x000317A4
|
|
// (set) Token: 0x0600117E RID: 4478 RVA: 0x000335DC File Offset: 0x000317DC
|
|
public bool Expired
|
|
{
|
|
get
|
|
{
|
|
return this.expires <= DateTime.Now && this.expires != DateTime.MinValue;
|
|
}
|
|
set
|
|
{
|
|
if (value)
|
|
{
|
|
this.expires = DateTime.Now;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the expiration date and time for the <see cref="T:System.Net.Cookie" /> as a <see cref="T:System.DateTime" />.</summary>
|
|
/// <returns>The expiration date and time for the <see cref="T:System.Net.Cookie" /> as a <see cref="T:System.DateTime" /> instance.</returns>
|
|
// Token: 0x170005BE RID: 1470
|
|
// (get) Token: 0x0600117F RID: 4479 RVA: 0x000335F0 File Offset: 0x000317F0
|
|
// (set) Token: 0x06001180 RID: 4480 RVA: 0x000335F8 File Offset: 0x000317F8
|
|
public DateTime Expires
|
|
{
|
|
get
|
|
{
|
|
return this.expires;
|
|
}
|
|
set
|
|
{
|
|
this.expires = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Determines whether a page script or other active content can access this cookie.</summary>
|
|
/// <returns>Boolean value that determines whether a page script or other active content can access this cookie.</returns>
|
|
// Token: 0x170005BF RID: 1471
|
|
// (get) Token: 0x06001181 RID: 4481 RVA: 0x00033604 File Offset: 0x00031804
|
|
// (set) Token: 0x06001182 RID: 4482 RVA: 0x0003360C File Offset: 0x0003180C
|
|
public bool HttpOnly
|
|
{
|
|
get
|
|
{
|
|
return this.httpOnly;
|
|
}
|
|
set
|
|
{
|
|
this.httpOnly = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the name for the <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>The name for the <see cref="T:System.Net.Cookie" />.</returns>
|
|
/// <exception cref="T:System.Net.CookieException">The value specified for a set operation is null or the empty string- or -The value specified for a set operation contained an illegal character. The following characters must not be used inside the <see cref="P:System.Net.Cookie.Name" /> property: equal sign, semicolon, comma, newline (\n), return (\r), tab (\t), and space character. The dollar sign character ("$") cannot be the first character.</exception>
|
|
// Token: 0x170005C0 RID: 1472
|
|
// (get) Token: 0x06001183 RID: 4483 RVA: 0x00033618 File Offset: 0x00031818
|
|
// (set) Token: 0x06001184 RID: 4484 RVA: 0x00033620 File Offset: 0x00031820
|
|
public string Name
|
|
{
|
|
get
|
|
{
|
|
return this.name;
|
|
}
|
|
set
|
|
{
|
|
if (Cookie.IsNullOrEmpty(value))
|
|
{
|
|
throw new CookieException("Name cannot be empty");
|
|
}
|
|
if (value[0] == '$' || value.IndexOfAny(Cookie.reservedCharsName) != -1)
|
|
{
|
|
this.name = string.Empty;
|
|
throw new CookieException("Name contains invalid characters");
|
|
}
|
|
this.name = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the URIs to which the <see cref="T:System.Net.Cookie" /> applies.</summary>
|
|
/// <returns>The URIs to which the <see cref="T:System.Net.Cookie" /> applies.</returns>
|
|
// Token: 0x170005C1 RID: 1473
|
|
// (get) Token: 0x06001185 RID: 4485 RVA: 0x00033680 File Offset: 0x00031880
|
|
// (set) Token: 0x06001186 RID: 4486 RVA: 0x000336A0 File Offset: 0x000318A0
|
|
public string Path
|
|
{
|
|
get
|
|
{
|
|
return (this.path != null) ? this.path : string.Empty;
|
|
}
|
|
set
|
|
{
|
|
this.path = ((value != null) ? value : string.Empty);
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets a list of TCP ports that the <see cref="T:System.Net.Cookie" /> applies to.</summary>
|
|
/// <returns>The list of TCP ports that the <see cref="T:System.Net.Cookie" /> applies to.</returns>
|
|
/// <exception cref="T:System.Net.CookieException">The value specified for a set operation could not be parsed or is not enclosed in double quotes. </exception>
|
|
// Token: 0x170005C2 RID: 1474
|
|
// (get) Token: 0x06001187 RID: 4487 RVA: 0x000336BC File Offset: 0x000318BC
|
|
// (set) Token: 0x06001188 RID: 4488 RVA: 0x000336C4 File Offset: 0x000318C4
|
|
public string Port
|
|
{
|
|
get
|
|
{
|
|
return this.port;
|
|
}
|
|
set
|
|
{
|
|
if (Cookie.IsNullOrEmpty(value))
|
|
{
|
|
this.port = string.Empty;
|
|
return;
|
|
}
|
|
if (value[0] != '"' || value[value.Length - 1] != '"')
|
|
{
|
|
throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Port must be enclosed by double quotes.");
|
|
}
|
|
this.port = value;
|
|
string[] array = this.port.Split(Cookie.portSeparators);
|
|
this.ports = new int[array.Length];
|
|
for (int i = 0; i < this.ports.Length; i++)
|
|
{
|
|
this.ports[i] = int.MinValue;
|
|
if (array[i].Length != 0)
|
|
{
|
|
try
|
|
{
|
|
this.ports[i] = int.Parse(array[i]);
|
|
}
|
|
catch (Exception ex)
|
|
{
|
|
throw new CookieException("The 'Port'='" + value + "' part of the cookie is invalid. Invalid value: " + array[i], ex);
|
|
}
|
|
}
|
|
}
|
|
this.Version = 1;
|
|
}
|
|
}
|
|
|
|
// Token: 0x170005C3 RID: 1475
|
|
// (get) Token: 0x06001189 RID: 4489 RVA: 0x000337D8 File Offset: 0x000319D8
|
|
internal int[] Ports
|
|
{
|
|
get
|
|
{
|
|
return this.ports;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the security level of a <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>true if the client is only to return the cookie in subsequent requests if those requests use Secure Hypertext Transfer Protocol (HTTPS); otherwise, false. The default is false.</returns>
|
|
// Token: 0x170005C4 RID: 1476
|
|
// (get) Token: 0x0600118A RID: 4490 RVA: 0x000337E0 File Offset: 0x000319E0
|
|
// (set) Token: 0x0600118B RID: 4491 RVA: 0x000337E8 File Offset: 0x000319E8
|
|
public bool Secure
|
|
{
|
|
get
|
|
{
|
|
return this.secure;
|
|
}
|
|
set
|
|
{
|
|
this.secure = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets the time when the cookie was issued as a <see cref="T:System.DateTime" />.</summary>
|
|
/// <returns>The time when the cookie was issued as a <see cref="T:System.DateTime" />.</returns>
|
|
// Token: 0x170005C5 RID: 1477
|
|
// (get) Token: 0x0600118C RID: 4492 RVA: 0x000337F4 File Offset: 0x000319F4
|
|
public DateTime TimeStamp
|
|
{
|
|
get
|
|
{
|
|
return this.timestamp;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the <see cref="P:System.Net.Cookie.Value" /> for the <see cref="T:System.Net.Cookie" />.</summary>
|
|
/// <returns>The <see cref="P:System.Net.Cookie.Value" /> for the <see cref="T:System.Net.Cookie" />.</returns>
|
|
// Token: 0x170005C6 RID: 1478
|
|
// (get) Token: 0x0600118D RID: 4493 RVA: 0x000337FC File Offset: 0x000319FC
|
|
// (set) Token: 0x0600118E RID: 4494 RVA: 0x00033804 File Offset: 0x00031A04
|
|
public string Value
|
|
{
|
|
get
|
|
{
|
|
return this.val;
|
|
}
|
|
set
|
|
{
|
|
if (value == null)
|
|
{
|
|
this.val = string.Empty;
|
|
return;
|
|
}
|
|
this.val = value;
|
|
}
|
|
}
|
|
|
|
/// <summary>Gets or sets the version of HTTP state maintenance to which the cookie conforms.</summary>
|
|
/// <returns>The version of HTTP state maintenance to which the cookie conforms.</returns>
|
|
/// <exception cref="T:System.ArgumentOutOfRangeException">The value specified for a version is not allowed. </exception>
|
|
// Token: 0x170005C7 RID: 1479
|
|
// (get) Token: 0x0600118F RID: 4495 RVA: 0x00033820 File Offset: 0x00031A20
|
|
// (set) Token: 0x06001190 RID: 4496 RVA: 0x00033828 File Offset: 0x00031A28
|
|
public int Version
|
|
{
|
|
get
|
|
{
|
|
return this.version;
|
|
}
|
|
set
|
|
{
|
|
if (value < 0 || value > 10)
|
|
{
|
|
this.version = 0;
|
|
}
|
|
else
|
|
{
|
|
this.version = value;
|
|
}
|
|
}
|
|
}
|
|
|
|
/// <summary>Overrides the <see cref="M:System.Object.Equals(System.Object)" /> method.</summary>
|
|
/// <returns>Returns true if the <see cref="T:System.Net.Cookie" /> is equal to <paramref name="comparand" />. Two <see cref="T:System.Net.Cookie" /> instances are equal if their <see cref="P:System.Net.Cookie.Name" />, <see cref="P:System.Net.Cookie.Value" />, <see cref="P:System.Net.Cookie.Path" />, <see cref="P:System.Net.Cookie.Domain" />, and <see cref="P:System.Net.Cookie.Version" /> properties are equal. <see cref="P:System.Net.Cookie.Name" /> and <see cref="P:System.Net.Cookie.Domain" /> string comparisons are case-insensitive.</returns>
|
|
/// <param name="comparand">A reference to a <see cref="T:System.Net.Cookie" />. </param>
|
|
// Token: 0x06001191 RID: 4497 RVA: 0x00033858 File Offset: 0x00031A58
|
|
public override bool Equals(object obj)
|
|
{
|
|
Cookie cookie = obj as Cookie;
|
|
return cookie != null && string.Compare(this.name, cookie.name, true, CultureInfo.InvariantCulture) == 0 && string.Compare(this.val, cookie.val, false, CultureInfo.InvariantCulture) == 0 && string.Compare(this.Path, cookie.Path, false, CultureInfo.InvariantCulture) == 0 && string.Compare(this.domain, cookie.domain, true, CultureInfo.InvariantCulture) == 0 && this.version == cookie.version;
|
|
}
|
|
|
|
/// <summary>Overrides the <see cref="M:System.Object.GetHashCode" /> method.</summary>
|
|
/// <returns>The 32-bit signed integer hash code for this instance.</returns>
|
|
// Token: 0x06001192 RID: 4498 RVA: 0x000338F4 File Offset: 0x00031AF4
|
|
public override int GetHashCode()
|
|
{
|
|
return Cookie.hash(CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(this.name), this.val.GetHashCode(), this.Path.GetHashCode(), CaseInsensitiveHashCodeProvider.DefaultInvariant.GetHashCode(this.domain), this.version);
|
|
}
|
|
|
|
// Token: 0x06001193 RID: 4499 RVA: 0x00033944 File Offset: 0x00031B44
|
|
private static int hash(int i, int j, int k, int l, int m)
|
|
{
|
|
return i ^ ((j << 13) | (j >> 19)) ^ ((k << 26) | (k >> 6)) ^ ((l << 7) | (l >> 25)) ^ ((m << 20) | (m >> 12));
|
|
}
|
|
|
|
/// <summary>Overrides the <see cref="M:System.Object.ToString" /> method.</summary>
|
|
/// <returns>Returns a string representation of this <see cref="T:System.Net.Cookie" /> object that is suitable for including in a HTTP Cookie: request header.</returns>
|
|
/// <PermissionSet>
|
|
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
|
/// </PermissionSet>
|
|
// Token: 0x06001194 RID: 4500 RVA: 0x00033970 File Offset: 0x00031B70
|
|
public override string ToString()
|
|
{
|
|
return this.ToString(null);
|
|
}
|
|
|
|
// Token: 0x06001195 RID: 4501 RVA: 0x0003397C File Offset: 0x00031B7C
|
|
internal string ToString(global::System.Uri uri)
|
|
{
|
|
if (this.name.Length == 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
StringBuilder stringBuilder = new StringBuilder(64);
|
|
if (this.version > 0)
|
|
{
|
|
stringBuilder.Append("$Version=").Append(this.version).Append("; ");
|
|
}
|
|
stringBuilder.Append(this.name).Append("=").Append(this.val);
|
|
if (this.version == 0)
|
|
{
|
|
return stringBuilder.ToString();
|
|
}
|
|
if (!Cookie.IsNullOrEmpty(this.path))
|
|
{
|
|
stringBuilder.Append("; $Path=").Append(this.path);
|
|
}
|
|
else if (uri != null)
|
|
{
|
|
stringBuilder.Append("; $Path=/").Append(this.path);
|
|
}
|
|
bool flag = uri == null || uri.Host != this.domain;
|
|
if (flag && !Cookie.IsNullOrEmpty(this.domain))
|
|
{
|
|
stringBuilder.Append("; $Domain=").Append(this.domain);
|
|
}
|
|
if (this.port != null && this.port.Length != 0)
|
|
{
|
|
stringBuilder.Append("; $Port=").Append(this.port);
|
|
}
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
// Token: 0x06001196 RID: 4502 RVA: 0x00033AE0 File Offset: 0x00031CE0
|
|
internal string ToClientString()
|
|
{
|
|
if (this.name.Length == 0)
|
|
{
|
|
return string.Empty;
|
|
}
|
|
StringBuilder stringBuilder = new StringBuilder(64);
|
|
if (this.version > 0)
|
|
{
|
|
stringBuilder.Append("Version=").Append(this.version).Append(";");
|
|
}
|
|
stringBuilder.Append(this.name).Append("=").Append(this.val);
|
|
if (this.path != null && this.path.Length != 0)
|
|
{
|
|
stringBuilder.Append(";Path=").Append(this.QuotedString(this.path));
|
|
}
|
|
if (this.domain != null && this.domain.Length != 0)
|
|
{
|
|
stringBuilder.Append(";Domain=").Append(this.QuotedString(this.domain));
|
|
}
|
|
if (this.port != null && this.port.Length != 0)
|
|
{
|
|
stringBuilder.Append(";Port=").Append(this.port);
|
|
}
|
|
return stringBuilder.ToString();
|
|
}
|
|
|
|
// Token: 0x06001197 RID: 4503 RVA: 0x00033C04 File Offset: 0x00031E04
|
|
private string QuotedString(string value)
|
|
{
|
|
if (this.version == 0 || this.IsToken(value))
|
|
{
|
|
return value;
|
|
}
|
|
return "\"" + value.Replace("\"", "\\\"") + "\"";
|
|
}
|
|
|
|
// Token: 0x06001198 RID: 4504 RVA: 0x00033C4C File Offset: 0x00031E4C
|
|
private bool IsToken(string value)
|
|
{
|
|
int length = value.Length;
|
|
for (int i = 0; i < length; i++)
|
|
{
|
|
char c = value[i];
|
|
if (c < ' ' || c >= '\u007f' || Cookie.tspecials.IndexOf(c) != -1)
|
|
{
|
|
return false;
|
|
}
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06001199 RID: 4505 RVA: 0x00033CA0 File Offset: 0x00031EA0
|
|
private static bool IsNullOrEmpty(string s)
|
|
{
|
|
return s == null || s.Length == 0;
|
|
}
|
|
|
|
// Token: 0x04000F78 RID: 3960
|
|
private string comment;
|
|
|
|
// Token: 0x04000F79 RID: 3961
|
|
private global::System.Uri commentUri;
|
|
|
|
// Token: 0x04000F7A RID: 3962
|
|
private bool discard;
|
|
|
|
// Token: 0x04000F7B RID: 3963
|
|
private string domain;
|
|
|
|
// Token: 0x04000F7C RID: 3964
|
|
private DateTime expires;
|
|
|
|
// Token: 0x04000F7D RID: 3965
|
|
private bool httpOnly;
|
|
|
|
// Token: 0x04000F7E RID: 3966
|
|
private string name;
|
|
|
|
// Token: 0x04000F7F RID: 3967
|
|
private string path;
|
|
|
|
// Token: 0x04000F80 RID: 3968
|
|
private string port;
|
|
|
|
// Token: 0x04000F81 RID: 3969
|
|
private int[] ports;
|
|
|
|
// Token: 0x04000F82 RID: 3970
|
|
private bool secure;
|
|
|
|
// Token: 0x04000F83 RID: 3971
|
|
private DateTime timestamp;
|
|
|
|
// Token: 0x04000F84 RID: 3972
|
|
private string val;
|
|
|
|
// Token: 0x04000F85 RID: 3973
|
|
private int version;
|
|
|
|
// Token: 0x04000F86 RID: 3974
|
|
private static char[] reservedCharsName = new char[] { ' ', '=', ';', ',', '\n', '\r', '\t' };
|
|
|
|
// Token: 0x04000F87 RID: 3975
|
|
private static char[] portSeparators = new char[] { '"', ',' };
|
|
|
|
// Token: 0x04000F88 RID: 3976
|
|
private static string tspecials = "()<>@,;:\\\"/[]?={} \t";
|
|
|
|
// Token: 0x04000F89 RID: 3977
|
|
private bool exact_domain;
|
|
}
|
|
}
|