//
// This optional method is only for protocols supporting a revalidation concept
// For a retried request this method must be called again.
//
internal CacheValidationStatus GetRevalidateStatus(WebResponse response, Stream responseStream)
{
if (response == null)
{
throw new ArgumentNullException("response");
}
if (_ProtocolStatus == CacheValidationStatus.DoNotUseCache)
{
return(CacheValidationStatus.DoNotUseCache);
}
// If we returned cached response, switch the state to not call cache anymore.
if (_ProtocolStatus == CacheValidationStatus.ReturnCachedResponse)
{
_ProtocolStatus = CacheValidationStatus.DoNotUseCache;
return(_ProtocolStatus);
}
try {
if (Logging.On)
{
Logging.Enter(Logging.RequestCache, this, "GetRevalidateStatus", (_Validator == null? null: _Validator.Request));
}
_Validator.FetchResponse(response);
if (_ProtocolStatus != CacheValidationStatus.Continue && _ProtocolStatus != CacheValidationStatus.RetryResponseFromServer)
{
if (Logging.On)
{
Logging.PrintInfo(Logging.RequestCache, SR.GetString(SR.net_log_cache_revalidation_not_needed, "GetRevalidateStatus()"));
}
return(_ProtocolStatus);
}
CheckRetrieveOnResponse(responseStream);
}
finally {
if (Logging.On)
{
Logging.Exit(Logging.RequestCache, this, "GetRevalidateStatus", "result = " + _ProtocolStatus.ToString());
}
}
return(_ProtocolStatus);
}