Imported Upstream version 5.4.0.167

Former-commit-id: 5624ac747d633e885131e8349322922b6a59baaa
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2017-08-21 15:34:15 +00:00
parent e49d6f06c0
commit 536cd135cc
12856 changed files with 563812 additions and 223249 deletions

View File

@ -53,7 +53,7 @@ namespace System.Web {
}
// This copy constructor is used by the granular request validation feature. The collections are mutable once
// created, but nobody should ever be mutating them, so it's ok for these to be out of [....]. Additionally,
// created, but nobody should ever be mutating them, so it's ok for these to be out of sync. Additionally,
// we don't copy _response since this should only ever be called for the request cookies.
internal HttpCookieCollection(HttpCookieCollection col)
: base(StringComparer.OrdinalIgnoreCase) {
@ -84,7 +84,7 @@ namespace System.Web {
if (append) {
// DevID 251951 Cookie is getting duplicated by ASP.NET when they are added via a native module
// Need to not double add response cookies from native modules
if (!cookie.FromHeader) {
if (!cookie.IsInResponseHeader) {
// mark cookie as new
cookie.Added = true;
}
@ -99,6 +99,17 @@ namespace System.Web {
}
}
// VSO bug #289778: when copying cookie from Response to Request, there is side effect
// which changes Added property and causes dup cookie in response header
// This method is meant to append cookie from one collection without changing cookie object
internal void Append(HttpCookieCollection cookies) {
for (int i = 0; i < cookies.Count; ++i) {
//BaseGet method doesn't trigger validation, while Get method does
HttpCookie cookie = (HttpCookie) cookies.BaseGet(i);
BaseAdd(cookie.Name, cookie);
}
}
// MSRC 12038: limit the maximum number of items that can be added to the collection,
// as a large number of items potentially can result in too many hash collisions that may cause DoS
private void ThrowIfMaxHttpCollectionKeysExceeded() {