scripts
This commit is contained in:
@@ -0,0 +1,193 @@
|
||||
using System;
|
||||
|
||||
namespace System.Net
|
||||
{
|
||||
// Token: 0x0200020F RID: 527
|
||||
internal class DigestHeaderParser
|
||||
{
|
||||
// Token: 0x060011E7 RID: 4583 RVA: 0x00035390 File Offset: 0x00033590
|
||||
public DigestHeaderParser(string header)
|
||||
{
|
||||
this.header = header.Trim();
|
||||
}
|
||||
|
||||
// Token: 0x170005DC RID: 1500
|
||||
// (get) Token: 0x060011E9 RID: 4585 RVA: 0x000353FC File Offset: 0x000335FC
|
||||
public string Realm
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.values[0];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170005DD RID: 1501
|
||||
// (get) Token: 0x060011EA RID: 4586 RVA: 0x00035408 File Offset: 0x00033608
|
||||
public string Opaque
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.values[1];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170005DE RID: 1502
|
||||
// (get) Token: 0x060011EB RID: 4587 RVA: 0x00035414 File Offset: 0x00033614
|
||||
public string Nonce
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.values[2];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170005DF RID: 1503
|
||||
// (get) Token: 0x060011EC RID: 4588 RVA: 0x00035420 File Offset: 0x00033620
|
||||
public string Algorithm
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.values[3];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170005E0 RID: 1504
|
||||
// (get) Token: 0x060011ED RID: 4589 RVA: 0x0003542C File Offset: 0x0003362C
|
||||
public string QOP
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.values[4];
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060011EE RID: 4590 RVA: 0x00035438 File Offset: 0x00033638
|
||||
public bool Parse()
|
||||
{
|
||||
if (!this.header.ToLower().StartsWith("digest "))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.pos = 6;
|
||||
this.length = this.header.Length;
|
||||
while (this.pos < this.length)
|
||||
{
|
||||
string text;
|
||||
string text2;
|
||||
if (!this.GetKeywordAndValue(out text, out text2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.SkipWhitespace();
|
||||
if (this.pos < this.length && this.header[this.pos] == ',')
|
||||
{
|
||||
this.pos++;
|
||||
}
|
||||
int num = Array.IndexOf<string>(DigestHeaderParser.keywords, text);
|
||||
if (num != -1)
|
||||
{
|
||||
if (this.values[num] != null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.values[num] = text2;
|
||||
}
|
||||
}
|
||||
return this.Realm != null && this.Nonce != null;
|
||||
}
|
||||
|
||||
// Token: 0x060011EF RID: 4591 RVA: 0x00035528 File Offset: 0x00033728
|
||||
private void SkipWhitespace()
|
||||
{
|
||||
char c = ' ';
|
||||
while (this.pos < this.length && (c == ' ' || c == '\t' || c == '\r' || c == '\n'))
|
||||
{
|
||||
c = this.header[this.pos++];
|
||||
}
|
||||
this.pos--;
|
||||
}
|
||||
|
||||
// Token: 0x060011F0 RID: 4592 RVA: 0x0003559C File Offset: 0x0003379C
|
||||
private string GetKey()
|
||||
{
|
||||
this.SkipWhitespace();
|
||||
int num = this.pos;
|
||||
while (this.pos < this.length && this.header[this.pos] != '=')
|
||||
{
|
||||
this.pos++;
|
||||
}
|
||||
return this.header.Substring(num, this.pos - num).Trim().ToLower();
|
||||
}
|
||||
|
||||
// Token: 0x060011F1 RID: 4593 RVA: 0x00035614 File Offset: 0x00033814
|
||||
private bool GetKeywordAndValue(out string key, out string value)
|
||||
{
|
||||
key = null;
|
||||
value = null;
|
||||
key = this.GetKey();
|
||||
if (this.pos >= this.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.SkipWhitespace();
|
||||
if (this.pos + 1 >= this.length || this.header[this.pos++] != '=')
|
||||
{
|
||||
return false;
|
||||
}
|
||||
this.SkipWhitespace();
|
||||
if (this.pos + 1 >= this.length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
bool flag = false;
|
||||
if (this.header[this.pos] == '"')
|
||||
{
|
||||
this.pos++;
|
||||
flag = true;
|
||||
}
|
||||
int num = this.pos;
|
||||
if (flag)
|
||||
{
|
||||
this.pos = this.header.IndexOf('"', this.pos);
|
||||
if (this.pos == -1)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
do
|
||||
{
|
||||
char c = this.header[this.pos];
|
||||
if (c == ',' || c == ' ' || c == '\t' || c == '\r' || c == '\n')
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
while (++this.pos < this.length);
|
||||
if (this.pos >= this.length && num == this.pos)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
value = this.header.Substring(num, this.pos - num);
|
||||
this.pos += 2;
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x04000FA4 RID: 4004
|
||||
private string header;
|
||||
|
||||
// Token: 0x04000FA5 RID: 4005
|
||||
private int length;
|
||||
|
||||
// Token: 0x04000FA6 RID: 4006
|
||||
private int pos;
|
||||
|
||||
// Token: 0x04000FA7 RID: 4007
|
||||
private static string[] keywords = new string[] { "realm", "opaque", "nonce", "algorithm", "qop" };
|
||||
|
||||
// Token: 0x04000FA8 RID: 4008
|
||||
private string[] values = new string[DigestHeaderParser.keywords.Length];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user