110 lines
2.3 KiB
C#
110 lines
2.3 KiB
C#
using System;
|
|
|
|
namespace System.Net
|
|
{
|
|
// Token: 0x0200023A RID: 570
|
|
internal class CookieParser
|
|
{
|
|
// Token: 0x06001462 RID: 5218 RVA: 0x00040AD4 File Offset: 0x0003ECD4
|
|
public CookieParser(string header)
|
|
: this(header, 0)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06001463 RID: 5219 RVA: 0x00040AE0 File Offset: 0x0003ECE0
|
|
public CookieParser(string header, int position)
|
|
{
|
|
this.header = header;
|
|
this.pos = position;
|
|
this.length = header.Length;
|
|
}
|
|
|
|
// Token: 0x06001464 RID: 5220 RVA: 0x00040B10 File Offset: 0x0003ED10
|
|
public bool GetNextNameValue(out string name, out string val)
|
|
{
|
|
name = null;
|
|
val = null;
|
|
if (this.pos >= this.length)
|
|
{
|
|
return false;
|
|
}
|
|
name = this.GetCookieName();
|
|
if (this.pos < this.header.Length && this.header[this.pos] == '=')
|
|
{
|
|
this.pos++;
|
|
val = this.GetCookieValue();
|
|
}
|
|
if (this.pos < this.length && this.header[this.pos] == ';')
|
|
{
|
|
this.pos++;
|
|
}
|
|
return true;
|
|
}
|
|
|
|
// Token: 0x06001465 RID: 5221 RVA: 0x00040BBC File Offset: 0x0003EDBC
|
|
private string GetCookieName()
|
|
{
|
|
int num = this.pos;
|
|
while (num < this.length && char.IsWhiteSpace(this.header[num]))
|
|
{
|
|
num++;
|
|
}
|
|
int num2 = num;
|
|
while (num < this.length && this.header[num] != ';' && this.header[num] != '=')
|
|
{
|
|
num++;
|
|
}
|
|
this.pos = num;
|
|
return this.header.Substring(num2, num - num2).Trim();
|
|
}
|
|
|
|
// Token: 0x06001466 RID: 5222 RVA: 0x00040C54 File Offset: 0x0003EE54
|
|
private string GetCookieValue()
|
|
{
|
|
if (this.pos >= this.length)
|
|
{
|
|
return null;
|
|
}
|
|
int num = this.pos;
|
|
while (num < this.length && char.IsWhiteSpace(this.header[num]))
|
|
{
|
|
num++;
|
|
}
|
|
int num2;
|
|
if (this.header[num] == '"')
|
|
{
|
|
num = (num2 = num + 1);
|
|
while (num < this.length && this.header[num] != '"')
|
|
{
|
|
num++;
|
|
}
|
|
int num3 = num;
|
|
while (num3 < this.length && this.header[num3] != ';')
|
|
{
|
|
num3++;
|
|
}
|
|
this.pos = num3;
|
|
}
|
|
else
|
|
{
|
|
num2 = num;
|
|
while (num < this.length && this.header[num] != ';')
|
|
{
|
|
num++;
|
|
}
|
|
this.pos = num;
|
|
}
|
|
return this.header.Substring(num2, num - num2).Trim();
|
|
}
|
|
|
|
// Token: 0x04001166 RID: 4454
|
|
private string header;
|
|
|
|
// Token: 0x04001167 RID: 4455
|
|
private int pos;
|
|
|
|
// Token: 0x04001168 RID: 4456
|
|
private int length;
|
|
}
|
|
}
|