public bool Read(PipeStream stream, Cookies cookies) { string lineData; while (stream.TryReadWith(HeaderTypeFactory.LINE_BYTES, out lineData)) { if (string.IsNullOrEmpty(lineData)) { return(true); } else { ReadOnlySpan <Char> line = lineData; if (line[0] == 'C' && line[5] == 'e' && line[1] == 'o' && line[2] == 'o' && line[3] == 'k' && line[4] == 'i') { HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies); } else { Tuple <string, string> result = HttpParse.AnalyzeHeader(line); this[result.Item1] = result.Item2; } } } return(false); }
public bool Read(PipeStream stream, Cookies cookies) { IndexOfResult index = stream.IndexOf(HeaderType.LINE_BYTES); while (index.End != null) { if (index.Length == 2) { stream.ReadFree(2); return(true); } else { ReadOnlySpan <Char> line = HttpParse.ReadCharLine(index); stream.ReadFree(index.Length); if (line[0] == 'C' && line[5] == 'e' && line[1] == 'o' && line[2] == 'o' && line[3] == 'k' && line[4] == 'i') { HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies); } else { Tuple <string, string> result = HttpParse.AnalyzeHeader(line); Add(result.Item1, result.Item2); } } index = stream.IndexOf(HeaderType.LINE_BYTES); } return(false); }
public void Import(string line) { if (!string.IsNullOrEmpty(line)) { Tuple <string, string> result = HttpParse.AnalyzeHeader(line); if (result.Item1 != null) { Add(result.Item1, result.Item2); } } }
public bool Read(PipeStream stream, Cookies cookies) { Span <char> lineData; while (stream.ReadLine(out lineData)) { if (lineData.Length == 0) { return(true); } else { ReadOnlySpan <Char> line = lineData; Tuple <string, string> result = HttpParse.AnalyzeHeader(line); this[result.Item1] = result.Item2; if (line[0] == 'C' && line[5] == 'e' && line[1] == 'o' && line[2] == 'o' && line[3] == 'k' && line[4] == 'i') { HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies); } } } return(false); }
public bool Read(PipeStream stream, Cookies cookies) { Span <char> lineData; while (stream.ReadLine(out lineData)) { if (lineData.Length == 0) { return(true); } else { ReadOnlySpan <Char> line = lineData; Tuple <string, string> result = HttpParse.AnalyzeHeader(line); this[result.Item1] = result.Item2; if (line.StartsWith(new ReadOnlySpan <char>(new [] { 'c', 'o', 'o', 'k', 'i', 'e' }), StringComparison.OrdinalIgnoreCase)) { HttpParse.AnalyzeCookie(line.Slice(8, line.Length - 8), cookies); } } } return(false); }