Exemplo n.º 1
0
 internal void ResetFromHeaders(string[] headers)
 {
     if (headers == null)
     {
         this._isModified = false;
         this._varyStar   = false;
         this._headers    = null;
     }
     else
     {
         this._isModified = true;
         if (headers[0].Equals("*"))
         {
             this._varyStar = true;
             this._headers  = null;
         }
         else
         {
             this._varyStar = false;
             this._headers  = new HttpDictionary();
             int index  = 0;
             int length = headers.Length;
             while (index < length)
             {
                 this._headers.SetValue(headers[index], headers[index]);
                 index++;
             }
         }
     }
 }
 internal void ResetFromParams(string[] parameters)
 {
     this.Reset();
     if (parameters != null)
     {
         this._isModified = true;
         if (parameters[0].Length == 0)
         {
             this.IgnoreParams = true;
         }
         else if (parameters[0].Equals("*"))
         {
             this._paramsStar = true;
         }
         else
         {
             this._parameters = new HttpDictionary();
             int index  = 0;
             int length = parameters.Length;
             while (index < length)
             {
                 this._parameters.SetValue(parameters[index], parameters[index]);
                 index++;
             }
         }
     }
 }
Exemplo n.º 3
0
 internal void Reset()
 {
     _isModified   = false;
     _paramsStar   = false;
     _parameters   = null;
     _ignoreParams = -1;
 }
Exemplo n.º 4
0
        /// <summary>
        /// Set the Headers in Cache Vary
        /// </summary>
        /// <param name="headers"></param>
        public void SetHeaders(string[] headers) {

            int i, n;

            if (headers == null) {
                _isModified = false;
                _varyStar = false;
                _headers = null;
            }
            else {           
                _isModified = true;
                if (headers[0].Equals("*")) {
                    Debug.Assert(headers.Length == 1, "headers.Length == 1");

                    _varyStar = true;
                    _headers = null;
                }
                else {
                    _varyStar = false;
                    _headers = new HttpDictionary();
                    for (i = 0, n = headers.Length; i < n; i++) {
                        _headers.SetValue(headers[i], headers[i]);
                    }
                }
            }
        }
Exemplo n.º 5
0
        public void SetCacheability(HttpCacheability cacheability, string field)
        {
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }
            switch (cacheability)
            {
            case HttpCacheability.NoCache:
                if (this._noCacheFields == null)
                {
                    this._noCacheFields = new HttpDictionary();
                }
                this._noCacheFields.SetValue(field, field);
                break;

            case HttpCacheability.Private:
                if (this._privateFields == null)
                {
                    this._privateFields = new HttpDictionary();
                }
                this._privateFields.SetValue(field, field);
                break;

            default:
                throw new ArgumentException(System.Web.SR.GetString("Cacheability_for_field_must_be_private_or_nocache"), "cacheability");
            }
            this.Dirtied();
        }
 internal void ResetFromHeaders(string[] headers)
 {
     if (headers == null)
     {
         this._isModified = false;
         this._varyStar = false;
         this._headers = null;
     }
     else
     {
         this._isModified = true;
         if (headers[0].Equals("*"))
         {
             this._varyStar = true;
             this._headers = null;
         }
         else
         {
             this._varyStar = false;
             this._headers = new HttpDictionary();
             int index = 0;
             int length = headers.Length;
             while (index < length)
             {
                 this._headers.SetValue(headers[index], headers[index]);
                 index++;
             }
         }
     }
 }
 internal void Reset()
 {
     this._isModified = false;
     this._paramsStar = false;
     this._parameters = null;
     this._ignoreParams = -1;
 }
Exemplo n.º 8
0
        /*
         * Reset based on the cached vary headers.
         */
        internal void ResetFromHeaders(String[] headers)
        {
            int i, n;

            if (headers == null)
            {
                _isModified = false;
                _varyStar   = false;
                _headers    = null;
            }
            else
            {
                _isModified = true;
                if (headers[0].Equals("*"))
                {
                    Debug.Assert(headers.Length == 1, "headers.Length == 1");

                    _varyStar = true;
                    _headers  = null;
                }
                else
                {
                    _varyStar = false;
                    _headers  = new HttpDictionary();
                    for (i = 0, n = headers.Length; i < n; i++)
                    {
                        _headers.SetValue(headers[i], headers[i]);
                    }
                }
            }
        }
Exemplo n.º 9
0
        //
        // Public methods and properties
        //

        /// <include file='doc\HttpCacheParams.uex' path='docs/doc[@for="HttpCacheVaryByParams.this"]/*' />
        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null)
                {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0)
                {
                    return(_ignoreParams == 1);
                }
                else
                {
                    return(_paramsStar ||
                           (_parameters != null && _parameters.GetValue(header) != null));
                }
            }

            set {
                if (header == null)
                {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0)
                {
                    IgnoreParams = value;
                }

                /*
                 * Since adding a Vary parameter is more restrictive, we don't
                 * want components to be able to set a Vary parameter to false
                 * if another component has set it to true.
                 */
                else if (value)
                {
                    _isModified   = true;
                    _ignoreParams = 0;
                    if (header.Equals("*"))
                    {
                        _paramsStar = true;
                        _parameters = null;
                    }
                    else
                    {
                        // set value to header if true or null if false
                        if (!_paramsStar)
                        {
                            if (_parameters == null)
                            {
                                _parameters = new HttpDictionary();
                            }

                            _parameters.SetValue(header, header);
                        }
                    }
                }
            }
        }
Exemplo n.º 10
0
        /*
         * Reset based on the cached vary headers.
         */
        internal void ResetFromParams(String[] parameters)
        {
            int i, n;

            Reset();
            if (parameters != null)
            {
                _isModified = true;
                if (parameters[0].Length == 0)
                {
                    Debug.Assert(parameters.Length == 1, "parameters.Length == 1");

                    IgnoreParams = true;
                }
                else if (parameters[0].Equals("*"))
                {
                    Debug.Assert(parameters.Length == 1, "parameters.Length == 1");

                    _paramsStar = true;
                }
                else
                {
                    _parameters = new HttpDictionary();
                    for (i = 0, n = parameters.Length; i < n; i++)
                    {
                        _parameters.SetValue(parameters[i], parameters[i]);
                    }
                }
            }
        }
Exemplo n.º 11
0
        /*
         * Vary by a given header
         */
        /// <include file='doc\HttpCacheVary.uex' path='docs/doc[@for="HttpCacheVaryByHeaders.this"]/*' />
        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null)
                {
                    throw new ArgumentNullException("header");
                }

                if (header.Equals("*"))
                {
                    return(_varyStar);
                }
                else
                {
                    return(_headers != null && _headers.GetValue(header) != null);
                }
            }

            set {
                if (header == null)
                {
                    throw new ArgumentNullException("header");
                }

                /*
                 * Since adding a Vary header is more restrictive, we don't
                 * want components to be able to set a Vary header to false
                 * if another component has set it to true.
                 */
                if (value == false)
                {
                    return;
                }

                _isModified = true;

                if (header.Equals("*"))
                {
                    VaryByUnspecifiedParameters();
                }
                else
                {
                    // set value to header if true or null if false
                    if (!_varyStar)
                    {
                        if (_headers == null)
                        {
                            _headers = new HttpDictionary();
                        }

                        _headers.SetValue(header, header);
                    }
                }
            }
        }
Exemplo n.º 12
0
 internal void Reset()
 {
     this._varyByContentEncodings.Reset();
     this._varyByHeaders.Reset();
     this._varyByParams.Reset();
     this._isModified          = false;
     this._hasSetCookieHeader  = false;
     this._noServerCaching     = false;
     this._cacheExtension      = null;
     this._noTransforms        = false;
     this._ignoreRangeRequests = false;
     this._varyByCustom        = null;
     this._cacheability        = HttpCacheability.Public | HttpCacheability.Private;
     this._noStore             = false;
     this._privateFields       = null;
     this._noCacheFields       = null;
     this._utcExpires          = DateTime.MinValue;
     this._isExpiresSet        = false;
     this._maxAge              = TimeSpan.Zero;
     this._isMaxAgeSet         = false;
     this._proxyMaxAge         = TimeSpan.Zero;
     this._isProxyMaxAgeSet    = false;
     this._slidingExpiration   = -1;
     this._slidingDelta        = TimeSpan.Zero;
     this._utcTimestampCreated = DateTime.MinValue;
     this._utcTimestampRequest = DateTime.MinValue;
     this._validUntilExpires   = -1;
     this._allowInHistory      = -1;
     this._revalidation        = HttpCacheRevalidation.None;
     this._utcLastModified     = DateTime.MinValue;
     this._isLastModifiedSet   = false;
     this._etag = null;
     this._generateLastModifiedFromFiles = false;
     this._generateEtagFromFiles         = false;
     this._validationCallbackInfo        = null;
     this._useCachedHeaders            = false;
     this._headerCacheControl          = null;
     this._headerPragma                = null;
     this._headerExpires               = null;
     this._headerLastModified          = null;
     this._headerEtag                  = null;
     this._headerVaryBy                = null;
     this._noMaxAgeInCacheControl      = false;
     this._hasUserProvidedDependencies = false;
     this._omitVaryStar                = -1;
 }
 public bool this[string header]
 {
     get
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Length == 0)
         {
             return(this._ignoreParams == 1);
         }
         return(this._paramsStar || ((this._parameters != null) && (this._parameters.GetValue(header) != null)));
     }
     set
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Length == 0)
         {
             this.IgnoreParams = value;
         }
         else if (value)
         {
             this._isModified   = true;
             this._ignoreParams = 0;
             if (header.Equals("*"))
             {
                 this._paramsStar = true;
                 this._parameters = null;
             }
             else if (!this._paramsStar)
             {
                 if (this._parameters == null)
                 {
                     this._parameters = new HttpDictionary();
                 }
                 this._parameters.SetValue(header, header);
             }
         }
     }
 }
Exemplo n.º 14
0
 public bool this[string header]
 {
     get
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Equals("*"))
         {
             return(this._varyStar);
         }
         return((this._headers != null) && (this._headers.GetValue(header) != null));
     }
     set
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (value)
         {
             this._isModified = true;
             if (header.Equals("*"))
             {
                 this.VaryByUnspecifiedParameters();
             }
             else if (!this._varyStar)
             {
                 if (this._headers == null)
                 {
                     this._headers = new HttpDictionary();
                 }
                 this._headers.SetValue(header, header);
             }
         }
     }
 }
Exemplo n.º 15
0
        /// <summary>
        /// Set the Parameters in Cache Vary 
        /// </summary>
        /// <param name="parameters"></param>
        public void SetParams(string[] parameters) {
            int i, n;

            Reset();
            if (parameters != null) {
                _isModified = true;
                if (parameters[0].Length == 0) {
                    Debug.Assert(parameters.Length == 1, "parameters.Length == 1");

                    IgnoreParams = true;
                }
                else if (parameters[0].Equals("*")) {
                    Debug.Assert(parameters.Length == 1, "parameters.Length == 1");

                    _paramsStar = true;
                }
                else {
                    _parameters = new HttpDictionary();
                    for (i = 0, n = parameters.Length; i < n; i++) {
                        _parameters.SetValue(parameters[i], parameters[i]);
                    }
                }
            }
        }
Exemplo n.º 16
0
        /// <devdoc>
        ///    <para>Sets the Cache-Control header to one of the values of HttpCacheability in 
        ///       conjunction with a field-level exclusion directive.</para>
        /// </devdoc>
        public void SetCacheability(HttpCacheability cacheability, String field) {
            if (field == null) {
                throw new ArgumentNullException("field");
            }

            switch (cacheability) {
                case HttpCacheability.Private:
                    if (_privateFields == null) {
                        _privateFields = new HttpDictionary();
                    }

                    _privateFields.SetValue(field, field);

                    break;

                case HttpCacheability.NoCache:
                    if (_noCacheFields == null) {
                        _noCacheFields = new HttpDictionary();
                    }

                    _noCacheFields.SetValue(field, field);

                    break;

                default:
                    throw new ArgumentException(
                            SR.GetString(SR.Cacheability_for_field_must_be_private_or_nocache),
                            "cacheability");
            }

            Dirtied();
        }
Exemplo n.º 17
0
        //
        // Public methods and properties
        // 


        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0) {
                    return _ignoreParams == 1;
                }
                else {
                    return _paramsStar || 
                           (_parameters != null && _parameters.GetValue(header) != null);
                }
            }

            set {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Length == 0) {
                    IgnoreParams = value;
                }
                /*
                 * Since adding a Vary parameter is more restrictive, we don't
                 * want components to be able to set a Vary parameter to false
                 * if another component has set it to true.
                 */
                else if (value) {
                    _isModified = true;
                    _ignoreParams = 0;
                    if (header.Equals("*")) {
                        _paramsStar = true;
                        _parameters = null;
                    }
                    else {
                        // set value to header if true or null if false
                        if (!_paramsStar) {
                            if (_parameters == null) {
                                _parameters = new HttpDictionary();
                            }

                            _parameters.SetValue(header, header);
                        }
                    }
                }
            }
        }
 public bool this[string header]
 {
     get
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Length == 0)
         {
             return (this._ignoreParams == 1);
         }
         return (this._paramsStar || ((this._parameters != null) && (this._parameters.GetValue(header) != null)));
     }
     set
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Length == 0)
         {
             this.IgnoreParams = value;
         }
         else if (value)
         {
             this._isModified = true;
             this._ignoreParams = 0;
             if (header.Equals("*"))
             {
                 this._paramsStar = true;
                 this._parameters = null;
             }
             else if (!this._paramsStar)
             {
                 if (this._parameters == null)
                 {
                     this._parameters = new HttpDictionary();
                 }
                 this._parameters.SetValue(header, header);
             }
         }
     }
 }
Exemplo n.º 19
0
 internal void Reset()
 {
     _isModified = false;
     _varyStar   = false;
     _headers    = null;
 }
 internal void ResetFromParams(string[] parameters)
 {
     this.Reset();
     if (parameters != null)
     {
         this._isModified = true;
         if (parameters[0].Length == 0)
         {
             this.IgnoreParams = true;
         }
         else if (parameters[0].Equals("*"))
         {
             this._paramsStar = true;
         }
         else
         {
             this._parameters = new HttpDictionary();
             int index = 0;
             int length = parameters.Length;
             while (index < length)
             {
                 this._parameters.SetValue(parameters[index], parameters[index]);
                 index++;
             }
         }
     }
 }
Exemplo n.º 21
0
        //
        // Public methods and properties
        //

        /// <include file='doc\HttpCacheVary.uex' path='docs/doc[@for="HttpCacheVaryByHeaders.VaryByUnspecifiedParameters"]/*' />
        /// <devdoc>
        ///    <para>Sets the "Vary: *" header and causes all other Vary:
        ///       header information to be dropped.</para>
        /// </devdoc>
        public void VaryByUnspecifiedParameters()
        {
            _isModified = true;
            _varyStar   = true;
            _headers    = null;
        }
Exemplo n.º 22
0
 internal HttpDictionaryEnumerator(HttpDictionary dict)
 {
     _dict = dict;
     _pos  = -1;
 }
 internal void Reset()
 {
     this._isModified = false;
     this._varyStar = false;
     this._headers = null;
 }
 public bool this[string header]
 {
     get
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (header.Equals("*"))
         {
             return this._varyStar;
         }
         return ((this._headers != null) && (this._headers.GetValue(header) != null));
     }
     set
     {
         if (header == null)
         {
             throw new ArgumentNullException("header");
         }
         if (value)
         {
             this._isModified = true;
             if (header.Equals("*"))
             {
                 this.VaryByUnspecifiedParameters();
             }
             else if (!this._varyStar)
             {
                 if (this._headers == null)
                 {
                     this._headers = new HttpDictionary();
                 }
                 this._headers.SetValue(header, header);
             }
         }
     }
 }
 public void VaryByUnspecifiedParameters()
 {
     this._isModified = true;
     this._varyStar = true;
     this._headers = null;
 }
Exemplo n.º 26
0
        internal void ResetFromHttpCachePolicySettings(HttpCachePolicySettings settings, DateTime utcTimestampRequest)
        {
            int num;
            int length;

            this._utcTimestampRequest = utcTimestampRequest;
            this._varyByContentEncodings.ResetFromContentEncodings(settings.VaryByContentEncodings);
            this._varyByHeaders.ResetFromHeaders(settings.VaryByHeaders);
            this._varyByParams.ResetFromParams(settings.VaryByParams);
            this._isModified          = settings.IsModified;
            this._hasSetCookieHeader  = settings.hasSetCookieHeader;
            this._noServerCaching     = settings.NoServerCaching;
            this._cacheExtension      = settings.CacheExtension;
            this._noTransforms        = settings.NoTransforms;
            this._ignoreRangeRequests = settings.IgnoreRangeRequests;
            this._varyByCustom        = settings.VaryByCustom;
            this._cacheability        = settings.CacheabilityInternal;
            this._noStore             = settings.NoStore;
            this._utcExpires          = settings.UtcExpires;
            this._isExpiresSet        = settings.IsExpiresSet;
            this._maxAge              = settings.MaxAge;
            this._isMaxAgeSet         = settings.IsMaxAgeSet;
            this._proxyMaxAge         = settings.ProxyMaxAge;
            this._isProxyMaxAgeSet    = settings.IsProxyMaxAgeSet;
            this._slidingExpiration   = settings.SlidingExpirationInternal;
            this._slidingDelta        = settings.SlidingDelta;
            this._utcTimestampCreated = settings.UtcTimestampCreated;
            this._validUntilExpires   = settings.ValidUntilExpiresInternal;
            this._allowInHistory      = settings.AllowInHistoryInternal;
            this._revalidation        = settings.Revalidation;
            this._utcLastModified     = settings.UtcLastModified;
            this._isLastModifiedSet   = settings.IsLastModifiedSet;
            this._etag = settings.ETag;
            this._generateLastModifiedFromFiles = settings.GenerateLastModifiedFromFiles;
            this._generateEtagFromFiles         = settings.GenerateEtagFromFiles;
            this._omitVaryStar = settings.OmitVaryStarInternal;
            this._hasUserProvidedDependencies = settings.HasUserProvidedDependencies;
            this._useCachedHeaders            = true;
            this._headerCacheControl          = settings.HeaderCacheControl;
            this._headerPragma           = settings.HeaderPragma;
            this._headerExpires          = settings.HeaderExpires;
            this._headerLastModified     = settings.HeaderLastModified;
            this._headerEtag             = settings.HeaderEtag;
            this._headerVaryBy           = settings.HeaderVaryBy;
            this._noMaxAgeInCacheControl = false;
            string[] privateFields = settings.PrivateFields;
            if (privateFields != null)
            {
                this._privateFields = new HttpDictionary();
                num    = 0;
                length = privateFields.Length;
                while (num < length)
                {
                    this._privateFields.SetValue(privateFields[num], privateFields[num]);
                    num++;
                }
            }
            privateFields = settings.NoCacheFields;
            if (privateFields != null)
            {
                this._noCacheFields = new HttpDictionary();
                num    = 0;
                length = privateFields.Length;
                while (num < length)
                {
                    this._noCacheFields.SetValue(privateFields[num], privateFields[num]);
                    num++;
                }
            }
            if (settings.ValidationCallbackInfo != null)
            {
                this._validationCallbackInfo = new ArrayList();
                num    = 0;
                length = settings.ValidationCallbackInfo.Length;
                while (num < length)
                {
                    this._validationCallbackInfo.Add(new ValidationCallbackInfo(settings.ValidationCallbackInfo[num].handler, settings.ValidationCallbackInfo[num].data));
                    num++;
                }
            }
        }
Exemplo n.º 27
0
 internal void Reset() {
     _isModified = false;
     _varyStar = false;
     _headers = null;
 }
Exemplo n.º 28
0
        /*
         * Restore original values
         */
        internal void Reset() {
            _varyByContentEncodings.Reset();
            _varyByHeaders.Reset();
            _varyByParams.Reset();

            _isModified = false;
            _hasSetCookieHeader = false;
            _noServerCaching = false;
            _cacheExtension = null;
            _noTransforms = false;
            _ignoreRangeRequests = false;
            _varyByCustom = null;
            _cacheability = (HttpCacheability) (int) HttpCacheabilityLimits.None;
            _noStore = false;
            _privateFields = null;
            _noCacheFields = null;
            _utcExpires = DateTime.MinValue;
            _isExpiresSet = false;
            _maxAge = TimeSpan.Zero;
            _isMaxAgeSet = false;
            _proxyMaxAge = TimeSpan.Zero;
            _isProxyMaxAgeSet = false;
            _slidingExpiration = -1;
            _slidingDelta = TimeSpan.Zero;
            _utcTimestampCreated = DateTime.MinValue;
            _utcTimestampRequest = DateTime.MinValue;
            _validUntilExpires = -1;
            _allowInHistory = -1;
            _revalidation = HttpCacheRevalidation.None;
            _utcLastModified = DateTime.MinValue;
            _isLastModifiedSet = false;
            _etag = null;

            _generateLastModifiedFromFiles = false; 
            _generateEtagFromFiles = false;         
            _validationCallbackInfo = null;       
        
            _useCachedHeaders = false;
            _headerCacheControl = null;
            _headerPragma = null;        
            _headerExpires = null;       
            _headerLastModified = null;  
            _headerEtag = null;          
            _headerVaryBy = null;       

            _noMaxAgeInCacheControl = false;

            _hasUserProvidedDependencies = false;

            _omitVaryStar = -1;
        }
Exemplo n.º 29
0
 internal void Reset()
 {
     this._isModified = false;
     this._varyStar   = false;
     this._headers    = null;
 }
Exemplo n.º 30
0
        /*
         * Reset based on a cached response. Includes data needed to generate
         * header for a cached response.
         */
        internal void ResetFromHttpCachePolicySettings(
                HttpCachePolicySettings settings,
                DateTime                utcTimestampRequest) {

            int i, n;
            string[] fields;
            
            _utcTimestampRequest = utcTimestampRequest;

            _varyByContentEncodings.ResetFromContentEncodings(settings.VaryByContentEncodings);
            _varyByHeaders.ResetFromHeaders(settings.VaryByHeaders);                          
            _varyByParams.ResetFromParams(settings.VaryByParams);

            _isModified                       = settings.IsModified;                    
            _hasSetCookieHeader               = settings.hasSetCookieHeader;
            _noServerCaching                  = settings.NoServerCaching;               
            _cacheExtension                   = settings.CacheExtension;                
            _noTransforms                     = settings.NoTransforms;                  
            _ignoreRangeRequests              = settings.IgnoreRangeRequests;
            _varyByCustom                     = settings.VaryByCustom;
            _cacheability                     = settings.CacheabilityInternal;                  
            _noStore                          = settings.NoStore;
            _utcExpires                       = settings.UtcExpires;                       
            _isExpiresSet                     = settings.IsExpiresSet;                  
            _maxAge                           = settings.MaxAge;                        
            _isMaxAgeSet                      = settings.IsMaxAgeSet;                   
            _proxyMaxAge                      = settings.ProxyMaxAge;                   
            _isProxyMaxAgeSet                 = settings.IsProxyMaxAgeSet;              
            _slidingExpiration                = settings.SlidingExpirationInternal;             
            _slidingDelta                     = settings.SlidingDelta;
            _utcTimestampCreated              = settings.UtcTimestampCreated;
            _validUntilExpires                = settings.ValidUntilExpiresInternal;
            _allowInHistory                   = settings.AllowInHistoryInternal;
            _revalidation                     = settings.Revalidation;                  
            _utcLastModified                  = settings.UtcLastModified;                  
            _isLastModifiedSet                = settings.IsLastModifiedSet;             
            _etag                             = settings.ETag;                          
            _generateLastModifiedFromFiles    = settings.GenerateLastModifiedFromFiles; 
            _generateEtagFromFiles            = settings.GenerateEtagFromFiles;         
            _omitVaryStar                     = settings.OmitVaryStarInternal;
            _hasUserProvidedDependencies      = settings.HasUserProvidedDependencies;

            _useCachedHeaders = true;
            _headerCacheControl = settings.HeaderCacheControl;
            _headerPragma = settings.HeaderPragma;        
            _headerExpires = settings.HeaderExpires;       
            _headerLastModified = settings.HeaderLastModified;  
            _headerEtag = settings.HeaderEtag;          
            _headerVaryBy = settings.HeaderVaryBy;        

            _noMaxAgeInCacheControl = false;

            fields = settings.PrivateFields;
            if (fields != null) {
                _privateFields = new HttpDictionary();
                for (i = 0, n = fields.Length; i < n; i++) {
                    _privateFields.SetValue(fields[i], fields[i]);
                }
            }

            fields = settings.NoCacheFields;
            if (fields != null) {
                _noCacheFields = new HttpDictionary();
                for (i = 0, n = fields.Length; i < n; i++) {
                    _noCacheFields.SetValue(fields[i], fields[i]);
                }
            }

            if (settings.ValidationCallbackInfo != null) {
                _validationCallbackInfo = new ArrayList();
                for (i = 0, n = settings.ValidationCallbackInfo.Length; i < n; i++) {
                    _validationCallbackInfo.Add(new ValidationCallbackInfo(
                            settings.ValidationCallbackInfo[i].handler,
                            settings.ValidationCallbackInfo[i].data));
                }
            }
        }
Exemplo n.º 31
0
        /*
         * Vary by a given header
         */

        /// <devdoc>
        ///    <para> Default property.
        ///       Indexed property indicating that a cache should (or should not) vary according
        ///       to a custom header.</para>
        /// </devdoc>
        public bool this[String header]
        {
            get {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                if (header.Equals("*")) {
                    return _varyStar;
                }
                else {
                    return (_headers != null && _headers.GetValue(header) != null);
                }
            }

            set {
                if (header == null) {
                    throw new ArgumentNullException("header");
                }

                /*
                 * Since adding a Vary header is more restrictive, we don't
                 * want components to be able to set a Vary header to false
                 * if another component has set it to true.
                 */
                if (value == false) {
                    return;
                }

                _isModified = true;

                if (header.Equals("*")) {
                    VaryByUnspecifiedParameters();
                }
                else {
                    // set value to header if true or null if false
                    if (!_varyStar) {
                        if (_headers == null) {
                            _headers = new HttpDictionary();
                        }

                        _headers.SetValue(header, header);
                    }
                }
            }
        }