Esempio n. 1
0
 // 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);
     }
 }
        // 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,
        // we don't copy _response since this should only ever be called for the request cookies.
        internal HttpCookieCollection(HttpCookieCollection col)
            : base(StringComparer.OrdinalIgnoreCase) {

            // We explicitly don't copy validation-related fields, as we want the copy to "reset" validation state.

            // Copy the file references from the original collection into this instance
            for (int i = 0; i < col.Count; i++) {
                ThrowIfMaxHttpCollectionKeysExceeded();
                string key = col.BaseGetKey(i);
                object value = col.BaseGet(i);
                BaseAdd(key, value);
            }

            IsReadOnly = col.IsReadOnly;
        }
Esempio n. 3
0
        // 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 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)
        {
            // We explicitly don't copy validation-related fields, as we want the copy to "reset" validation state.

            // Copy the file references from the original collection into this instance
            for (int i = 0; i < col.Count; i++)
            {
                ThrowIfMaxHttpCollectionKeysExceeded();
                string key   = col.BaseGetKey(i);
                object value = col.BaseGet(i);
                BaseAdd(key, value);
            }

            IsReadOnly = col.IsReadOnly;
        }