RusKnyaz / Optimus

Optimus is headless Web Browser fully implemented on .net.
MIT License
82 stars 8 forks source link

System.AggregateException: The SSL connection could not be established #44

Closed AdiMarianMutu closed 4 years ago

AdiMarianMutu commented 4 years ago

Hi,

I get this error when I use OpenUrl with this site

Using the last version of Visual Studio with Xamarin.

My test code:

 b.OpenUrl(URL_QUEUE_PAGE).Wait();

((HtmlInputElement)b.Document.GetElementsByClassName("user")[0]).Value = SharedSettings.SecureEntries.Get("rtUser");
((HtmlInputElement)b.Document.GetElementsByClassName("pass")[0]).Value = SharedSettings.SecureEntries.Get("rtPass");
((HtmlInputElement)b.Document.GetElementsByClassName("button")[0]).Click();

string a = ((HtmlInputElement)b.Document.GetElementsByClassName("action-results")[0]).TextContent;
System.AggregateException
  Message=One or more errors occurred. (One or more errors occurred. (The SSL connection could not be established, see inner exception.))
  Source=mscorlib
  StackTrace:
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00011] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2027 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00043] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2759 
  at System.Threading.Tasks.Task.Wait () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/external/corert/src/System.Private.CoreLib/src/System/Threading/Tasks/Task.cs:2625 
  at CGSJDSportsNotification.Droid.JDMonitoring.AlarmElapsed (System.Object sender, System.Timers.ElapsedEventArgs e) [0x00008] in D:\Software Development\Visual Studio\C#\Mobile\Android\CGSJDSportsNotification\CGSJDSportsNotification.Android\JDMonitoring.cs:210 
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore+<>c.<ThrowAsync>b__7_1 (System.Object state) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1037 
  at System.Threading.QueueUserWorkItemCallback.WaitCallback_Context (System.Object state) [0x0000d] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1370 
  at System.Threading.ExecutionContext.RunInternal (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00071] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:968 
  at System.Threading.ExecutionContext.Run (System.Threading.ExecutionContext executionContext, System.Threading.ContextCallback callback, System.Object state, System.Boolean preserveSyncCtx) [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/executioncontext.cs:910 
  at System.Threading.QueueUserWorkItemCallback.System.Threading.IThreadPoolWorkItem.ExecuteWorkItem () [0x00021] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1341 
  at System.Threading.ThreadPoolWorkQueue.Dispatch () [0x00074] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:899 
  at System.Threading._ThreadPoolWaitCallback.PerformWaitCallback () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/referencesource/mscorlib/system/threading/threadpool.cs:1261 
RusKnyaz commented 4 years ago

Added new API to allow configure HttpClientHandler:

var engine = var engine = EngineBuilder.New().ConfigureResourceProvider(
    r => r.Http(
        h => h.ConfigureClientHandler(
            c =>  c.ServerCertificateCustomValidationCallback+= (message, certificate2, arg3, arg4) => true )))
    .Build();