Пример #1
0
        internal static RequestCookieCollection ParseInternal(StringValues values, bool enableCookieNameEncoding)
        {
            if (values.Count == 0)
            {
                return(Empty);
            }
            var collection = new RequestCookieCollection(values.Count);
            var store      = collection.Store !;

            if (CookieHeaderParserShared.TryParseValues(values, store, enableCookieNameEncoding, supportsMultipleValues: true))
            {
                if (store.Count == 0)
                {
                    return(Empty);
                }

                return(collection);
            }
            return(Empty);
        }
Пример #2
0
    internal static RequestCookieCollection ParseInternal(StringValues values, bool enableCookieNameEncoding)
    {
        if (values.Count == 0)
        {
            return(Empty);
        }

        // Do not set the collection capacity based on StringValues.Count, the Cookie header is supposed to be a single combined value.
        var collection = new RequestCookieCollection();
        var store      = collection.Store !;

        if (CookieHeaderParserShared.TryParseValues(values, store, enableCookieNameEncoding, supportsMultipleValues: true))
        {
            if (store.Count == 0)
            {
                return(Empty);
            }

            return(collection);
        }
        return(Empty);
    }