private void UpdateCachedHeaders(HttpResponse response) { if (!this._useCachedHeaders) { HttpCacheability @private; int num; int size; if (this._utcTimestampCreated == DateTime.MinValue) { this._utcTimestampCreated = this._utcTimestampRequest = response.Context.UtcTimestamp; } if (this._slidingExpiration != 1) { this._slidingDelta = TimeSpan.Zero; } else if (this._isMaxAgeSet) { this._slidingDelta = this._maxAge; } else if (this._isExpiresSet) { this._slidingDelta = (TimeSpan)(this._utcExpires - this._utcTimestampCreated); } else { this._slidingDelta = TimeSpan.Zero; } this._headerCacheControl = null; this._headerPragma = null; this._headerExpires = null; this._headerLastModified = null; this._headerEtag = null; this._headerVaryBy = null; this.UpdateFromDependencies(response); StringBuilder s = new StringBuilder(); if (this._cacheability == (HttpCacheability.Public | HttpCacheability.Private)) { @private = HttpCacheability.Private; } else { @private = this._cacheability; } AppendValueToHeader(s, s_cacheabilityTokens[(int)@private]); if ((@private == HttpCacheability.Public) && (this._privateFields != null)) { AppendValueToHeader(s, "private=\""); s.Append(this._privateFields.GetKey(0)); num = 1; size = this._privateFields.Size; while (num < size) { AppendValueToHeader(s, this._privateFields.GetKey(num)); num++; } s.Append('"'); } if (((@private != HttpCacheability.NoCache) && (@private != HttpCacheability.Server)) && (this._noCacheFields != null)) { AppendValueToHeader(s, "no-cache=\""); s.Append(this._noCacheFields.GetKey(0)); num = 1; size = this._noCacheFields.Size; while (num < size) { AppendValueToHeader(s, this._noCacheFields.GetKey(num)); num++; } s.Append('"'); } if (this._noStore) { AppendValueToHeader(s, "no-store"); } AppendValueToHeader(s, s_revalidationTokens[(int)this._revalidation]); if (this._noTransforms) { AppendValueToHeader(s, "no-transform"); } if (this._cacheExtension != null) { AppendValueToHeader(s, this._cacheExtension); } if (((this._slidingExpiration == 1) && (@private != HttpCacheability.NoCache)) && (@private != HttpCacheability.Server)) { if (this._isMaxAgeSet && !this._noMaxAgeInCacheControl) { AppendValueToHeader(s, "max-age=" + ((long)this._maxAge.TotalSeconds).ToString(CultureInfo.InvariantCulture)); } if (this._isProxyMaxAgeSet && !this._noMaxAgeInCacheControl) { AppendValueToHeader(s, "s-maxage=" + ((long)this._proxyMaxAge.TotalSeconds).ToString(CultureInfo.InvariantCulture)); } } if (s.Length > 0) { this._headerCacheControl = new HttpResponseHeader(0, s.ToString()); } switch (@private) { case HttpCacheability.NoCache: case HttpCacheability.Server: if (s_headerPragmaNoCache == null) { s_headerPragmaNoCache = new HttpResponseHeader(4, "no-cache"); } this._headerPragma = s_headerPragmaNoCache; if (this._allowInHistory != 1) { if (s_headerExpiresMinus1 == null) { s_headerExpiresMinus1 = new HttpResponseHeader(0x12, "-1"); } this._headerExpires = s_headerExpiresMinus1; } break; default: if (this._isExpiresSet && (this._slidingExpiration != 1)) { string str = HttpUtility.FormatHttpDateTimeUtc(this._utcExpires); this._headerExpires = new HttpResponseHeader(0x12, str); } if (this._isLastModifiedSet) { string str2 = HttpUtility.FormatHttpDateTimeUtc(this._utcLastModified); this._headerLastModified = new HttpResponseHeader(0x13, str2); } if (@private != HttpCacheability.Private) { bool omitVaryStar; if (this._etag != null) { this._headerEtag = new HttpResponseHeader(0x16, this._etag); } string str3 = null; if (this._omitVaryStar != -1) { omitVaryStar = this._omitVaryStar == 1; } else { OutputCacheSection outputCache = RuntimeConfig.GetLKGConfig(response.Context).OutputCache; if (outputCache != null) { omitVaryStar = outputCache.OmitVaryStar; } else { omitVaryStar = false; } } if (!omitVaryStar && ((this._varyByCustom != null) || (this._varyByParams.IsModified() && !this._varyByParams.IgnoreParams))) { str3 = "*"; } if (str3 == null) { str3 = this._varyByHeaders.ToHeaderString(); } if (str3 != null) { this._headerVaryBy = new HttpResponseHeader(0x1c, str3); } } break; } this._useCachedHeaders = true; } }