1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace BestHTTP.Extensions
- {
-
-
-
-
- public sealed class WWWAuthenticateHeaderParser : KeyValuePairList
- {
- public WWWAuthenticateHeaderParser(string headerValue)
- {
- Values = ParseQuotedHeader(headerValue);
- }
- private List<HeaderValue> ParseQuotedHeader(string str)
- {
- List<HeaderValue> result = new List<HeaderValue>();
- if (str != null)
- {
- int idx = 0;
-
- string type = str.Read(ref idx, (ch) => !char.IsWhiteSpace(ch) && !char.IsControl(ch)).TrimAndLower();
- result.Add(new HeaderValue(type));
-
- while (idx < str.Length)
- {
-
- string key = str.Read(ref idx, '=').TrimAndLower();
- HeaderValue qp = new HeaderValue(key);
-
- str.SkipWhiteSpace(ref idx);
- qp.Value = str.ReadPossibleQuotedText(ref idx);
- result.Add(qp);
- }
- }
- return result;
- }
- }
- }
|