public HttpParser FieldValue(out IEnumerable <byte> fieldValue) { if (!this.Success) { fieldValue = (IEnumerable <byte>)null; return(this); } this.SkipLws(); this.FieldContent(out fieldValue); if (!Enumerable.Any <byte>(fieldValue)) { return(this); } while (this.Success) { this.SkipLws(); IEnumerable <byte> fieldContent; this.FieldContent(out fieldContent); if (Enumerable.Any <byte>(fieldContent)) { fieldValue = Enumerable.Concat <byte>(IEnumerableExtensions.Concat <byte>(fieldValue, (byte)32), fieldContent); } else { break; } } return(this); }
private static IList <T> EndOptions(IList <T> options, T end) { if (options.Count == 0 || (Enumerable.Last <T>((IEnumerable <T>)options).Equivalent((Option)end) || Options <T> .SumBytesLength((IEnumerable <T>)options) % 4 == 0)) { return(options); } return((IList <T>) new List <T>(IEnumerableExtensions.Concat <T>((IEnumerable <T>)options, end))); }
internal HttpHeader(IEnumerable <KeyValuePair <string, IEnumerable <byte> > > fields) { Dictionary <string, IEnumerable <byte> > dictionary = new Dictionary <string, IEnumerable <byte> >((IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); foreach (KeyValuePair <string, IEnumerable <byte> > keyValuePair in fields) { string key = keyValuePair.Key; IEnumerable <byte> sequence; if (!dictionary.TryGetValue(key, out sequence)) { sequence = keyValuePair.Value; dictionary.Add(key, sequence); } else { dictionary[key] = Enumerable.Concat <byte>(IEnumerableExtensions.Concat <byte>(sequence, (byte)44), keyValuePair.Value); } } this._fields = Enumerable.ToDictionary <KeyValuePair <string, IEnumerable <byte> >, string, HttpField>((IEnumerable <KeyValuePair <string, IEnumerable <byte> > >)dictionary, (Func <KeyValuePair <string, IEnumerable <byte> >, string>)(field => field.Key), (Func <KeyValuePair <string, IEnumerable <byte> >, HttpField>)(field => HttpField.CreateField(field.Key, Enumerable.ToArray <byte>(field.Value))), (IEqualityComparer <string>)StringComparer.OrdinalIgnoreCase); }