private void ParseAndAddValue( HeaderDescriptor descriptor, HttpHeaders.HeaderStoreItemInfo info, string value) { if (descriptor.Parser == null) { HttpHeaders.CheckInvalidNewLine(value); HttpHeaders.AddValue(info, (object)(value ?? string.Empty), HttpHeaders.StoreLocation.Parsed); } else { if (!info.CanAddValue(descriptor.Parser)) { throw new FormatException(SR.Format((IFormatProvider)CultureInfo.InvariantCulture, SR.net_http_headers_single_value_header, (object)descriptor.Name)); } int index = 0; object obj1 = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); if (value == null || index == value.Length) { if (obj1 == null) { return; } HttpHeaders.AddValue(info, obj1, HttpHeaders.StoreLocation.Parsed); } else { List <object> objectList = new List <object>(); if (obj1 != null) { objectList.Add(obj1); } while (index < value.Length) { object obj2 = descriptor.Parser.ParseValue(value, info.ParsedValue, ref index); if (obj2 != null) { objectList.Add(obj2); } } foreach (object obj2 in objectList) { HttpHeaders.AddValue(info, obj2, HttpHeaders.StoreLocation.Parsed); } } } }