培训考核三期,新版培训,网页版培训登录器
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
972 B

using System.Collections.Generic;
namespace BestHTTP.Extensions
{
/// <summary>
/// Will parse a comma-separeted header value
/// </summary>
public sealed class HeaderParser : KeyValuePairList
{
public HeaderParser(string headerStr)
{
base.Values = Parse(headerStr);
}
private List<HeaderValue> Parse(string headerStr)
{
List<HeaderValue> result = new List<HeaderValue>();
int pos = 0;
try
{
while (pos < headerStr.Length)
{
HeaderValue current = new HeaderValue();
current.Parse(headerStr, ref pos);
result.Add(current);
}
}
catch(System.Exception ex)
{
HTTPManager.Logger.Exception("HeaderParser - Parse", headerStr, ex);
}
return result;
}
}
}