internal CacheValidationStatus GetUpdateStatus (WebResponse response, Stream responseStream)
{
if (response == null)
throw new ArgumentNullException("response");
if (_ProtocolStatus == CacheValidationStatus.DoNotUseCache)
return CacheValidationStatus.DoNotUseCache;
try {
if(Logging.On) Logging.Enter(Logging.RequestCache, this, "GetUpdateStatus", null);
if (_Validator.Response == null)
_Validator.FetchResponse(response);
if (_ProtocolStatus == CacheValidationStatus.RemoveFromCache)
{
EnsureCacheRemoval(_Validator.CacheKey);
return _ProtocolStatus;
}
if (_ProtocolStatus != CacheValidationStatus.DoNotTakeFromCache &&
_ProtocolStatus != CacheValidationStatus.ReturnCachedResponse &&
_ProtocolStatus != CacheValidationStatus.CombineCachedAndServerResponse)
{
if(Logging.On) Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_not_updated_based_on_cache_protocol_status, "GetUpdateStatus()", _ProtocolStatus.ToString()));
return _ProtocolStatus;
}
CheckUpdateOnResponse(responseStream);
}
catch (Exception e) {
_ProtocolException = e;
_ProtocolStatus = CacheValidationStatus.Fail;
if (e is ThreadAbortException || e is StackOverflowException || e is OutOfMemoryException) {
throw;
}
if(Logging.On) Logging.PrintError(Logging.RequestCache, SR.GetString(SR.net_log_cache_object_and_exception, "CacheProtocol#" + this.GetHashCode().ToString(NumberFormatInfo.InvariantInfo), (e is WebException? e.Message: e.ToString())));
}
finally {
if(Logging.On)Logging.Exit(Logging.RequestCache, this, "GetUpdateStatus", "result = " + _ProtocolStatus.ToString());
}
return _ProtocolStatus;
}
//