Imported Upstream version 4.8.0.309

Former-commit-id: 5f9c6ae75f295e057a7d2971f3a6df4656fa8850
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-11-10 13:04:39 +00:00
parent ee1447783b
commit 94b2861243
4912 changed files with 390737 additions and 49310 deletions

View File

@ -36,6 +36,7 @@ namespace System.Net.Http.Headers
readonly List<T> list;
readonly HttpHeaders headers;
readonly HeaderInfo headerInfo;
List<string> invalidValues;
internal HttpHeaderValueCollection (HttpHeaders headers, HeaderInfo headerInfo)
{
@ -50,6 +51,12 @@ namespace System.Net.Http.Headers
}
}
internal List<string> InvalidValues {
get {
return invalidValues;
}
}
public bool IsReadOnly {
get {
return false;
@ -66,9 +73,18 @@ namespace System.Net.Http.Headers
list.AddRange (values);
}
internal void AddInvalidValue (string invalidValue)
{
if (invalidValues == null)
invalidValues = new List<string> ();
invalidValues.Add (invalidValue);
}
public void Clear ()
{
list.Clear ();
invalidValues = null;
}
public bool Contains (T item)
@ -93,11 +109,12 @@ namespace System.Net.Http.Headers
public override string ToString ()
{
// This implementation prints different values than
// what .NET does when one of the values is invalid
// But it better represents what is actually hold by
// the collection
return string.Join (headerInfo.Separator, list);
var res = string.Join (headerInfo.Separator, list);
if (invalidValues != null)
res += string.Join (headerInfo.Separator, invalidValues);
return res;
}
public bool TryParseAdd (string input)