internal string FindProxyForURL(string url, string host)
{
if (url == null || host == null)
{
throw new ArgumentNullException(url == null ? "url" : "host");
}
if (closed != 0)
{
throw new ObjectDisposedException(GetType().Name);
}
EXCEPINFO exceptionInfo = new EXCEPINFO();
object result = null;
jscript.GetCurrentScriptThreadID(out interruptThreadId);
TimerThread.Timer timer = s_TimerQueue.CreateTimer(s_InterruptCallback, this);
activeTimer = timer;
try
{
GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Calling url:" + url + " host:" + host);
result = script.FindProxyForURL(url, host);
}
catch (Exception exception)
{
if (NclUtilities.IsFatal(exception))
{
throw;
}
if (exception is TargetInvocationException)
{
exception = exception.InnerException;
}
COMException comException = exception as COMException;
if (comException == null || comException.ErrorCode != (int)HRESULT.SCRIPT_E_REPORTED)
{
throw;
}
GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Script error:[" + this.host.ExceptionMessage == null ? "" : this.host.ExceptionMessage + "]");
}
catch {
GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Script error:[Non-CLS Compliant Exception]");
throw;
}
finally
{
activeTimer = null;
timer.Cancel();
}
string proxy = result as string;
if (proxy != null)
{
GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() found:" + proxy);
return(proxy);
}
GlobalLog.Print("AutoWebProxyScriptWrapper#" + ValidationHelper.HashString(this) + "::FindProxyForURL() Returning null. result:" + ValidationHelper.ToString(exceptionInfo.bstrDescription) + " result:" + ValidationHelper.ToString(result) + " error:" + ValidationHelper.ToString(exceptionInfo.bstrDescription));
return(null);
}