private void FinallyUpdateCacheEntry() {
// Transfer the context status line back to the metadata
CacheEntry.EntryMetadata = null;
CacheEntry.SystemMetadata = null;
if (CacheHeaders == null) {
//must be an entry update without updating the headers
return;
}
CacheEntry.EntryMetadata = new StringCollection();
CacheEntry.SystemMetadata = new StringCollection();
if (CacheHttpVersion == null) {
if(Logging.On)Logging.PrintWarning(Logging.RequestCache, SR.GetString(SR.net_log_cache_invalid_http_version));
CacheHttpVersion = new Version(1, 0);
}
// HTTP/1.1 200 OK
System.Text.StringBuilder sb = new System.Text.StringBuilder(CacheStatusDescription.Length + 20);
sb.Append("HTTP/");
sb.Append(CacheHttpVersion.ToString(2));
sb.Append(' ');
sb.Append(((int)CacheStatusCode).ToString(NumberFormatInfo.InvariantInfo));
sb.Append(' ');
sb.Append(CacheStatusDescription);
// Fetch the status line into cache metadata
CacheEntry.EntryMetadata.Add(sb.ToString());
UpdateStringCollection(CacheEntry.EntryMetadata, CacheHeaders, false);
if (SystemMeta != null)
{
UpdateStringCollection(CacheEntry.SystemMetadata, SystemMeta, true);
}
// Update other entry values
if (ResponseExpires != DateTime.MinValue) {
CacheEntry.ExpiresUtc = ResponseExpires;
}
if (ResponseLastModified != DateTime.MinValue)
{
CacheEntry.LastModifiedUtc = ResponseLastModified;
}
if (this.Policy.Level == HttpRequestCacheLevel.Default)
{
CacheEntry.MaxStale = this.Policy.MaxStale;
}
CacheEntry.LastSynchronizedUtc = DateTime.UtcNow;
}
//