protected internal override CacheValidationStatus ValidateResponse() {
if (this.Policy.Level != HttpRequestCacheLevel.CacheOrNextCacheOnly &&
this.Policy.Level != HttpRequestCacheLevel.Default &&
this.Policy.Level != HttpRequestCacheLevel.Revalidate)
{
// Those policy levels do not modify requests
if(Logging.On)Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_response_valid_based_on_policy, Policy.ToString()));
return CacheValidationStatus.Continue;
}
// We will need quick access to cache controls coming with the live response
HttpWebResponse resp = Response as HttpWebResponse;
if (resp == null) {
if(Logging.On)Logging.PrintWarning(Logging.RequestCache, SR.GetString(SR.net_log_cache_null_response_failure));
return CacheValidationStatus.Continue;
}
FetchHeaderValues(false);
if(Logging.On) Logging.PrintInfo(Logging.RequestCache, "StatusCode=" + ((int)resp.StatusCode).ToString(CultureInfo.InvariantCulture) + ' ' +resp.StatusCode.ToString() +
(resp.StatusCode == HttpStatusCode.PartialContent
?", Content-Range: " + resp.Headers[HttpKnownHeaderNames.ContentRange]
:string.Empty)
);
// Apply our best knowledge of HTTP caching and return the result
// that can be hooked up and revised by the upper level
return Rfc2616.OnValidateResponse(this);
}