Hi,
i’m building a webscraper and i get this error when i send to many webrequests:
TlsException: Handshake failed - error code: UNITYTLS_INTERNAL_ERROR, verify result: UNITYTLS_X509VERIFY_NOT_DONE
One of my tests sends about 1000 requests, the first few times the test runs fine, but at some point i get the above mentioned error.
Restarting Unity fixes the issue temporarily.
Here’s my HttpClient:
private static readonly Lazy<HttpClient> httpClient = new(() => new HttpClient(new HttpClientHandler
{
ServerCertificateCustomValidationCallback = (_, _, _, _) => true,
ClientCertificateOptions = ClientCertificateOption.Automatic,
SslProtocols = SslProtocols.None
})
{
BaseAddress = new Uri("https://yugioh.fandom.com/"),
Timeout = TimeSpan.FromSeconds(15),
DefaultRequestHeaders =
{
ConnectionClose = true
}
});
Changing the settings in the HttpClient (or having no custom settings at all) doesn’t fix the issue.
I’ve read that UnityWebRequest might not have these issues, but it can only be called from the main thread and i don’t want to restructure everything to use Coroutines.
Has anyone ever had this problem?