private IResponse RetryRequestProcessor(int retryWait, int retryLimit, string url, string method,
Dictionary<string, string> data = null,
CookieContainer cookies = null, bool xHeaders = true, string referer = "", bool isWebkit = false)
{
int attempts = 0;
while (true)
{
try
{
return _webRequestHandler.HandleWebRequest(url, method, data, cookies, xHeaders, referer, isWebkit);
}
catch (WebException we)
{
HttpWebResponse response = we.Response as HttpWebResponse;;
switch (we.Status)
{
case WebExceptionStatus.SendFailure:
break;
case WebExceptionStatus.ConnectFailure:
break;
case WebExceptionStatus.ConnectionClosed:
break;
case WebExceptionStatus.ReceiveFailure:
break;
case WebExceptionStatus.Timeout:
break;
case WebExceptionStatus.ProtocolError:
break;
default:
if (response?.StatusCode == HttpStatusCode.NotFound)
return null;
throw;
}
if (attempts >= retryLimit)
return null;
attempts++;
}
Thread.Sleep(retryWait);
}
}