Hi,
I have been getting intermittent issues with the error ‘Unable to complete SSL connection’ using UnityWebRequest and communicating with a local ASPnet server. The network functionality does work with both https and http, and we use custom certificate handling during development. This is on Unity 6000.1.16f1.
I have not encountered this error only until I am sending a large number of requests from one unity client for general load-testing. The error doesn’t occur until the number of requests sent by the instance of unity editor reaches a certain threshold, and then from that point they all failed with response code 0 - Unable to complete SSL connection.
Restarting the unity editor fixes this problem. I have also noticed that changing build profiles (which are pretty much identical) can also fix the issue.
IEnumerator GetGroupData(Action callback, RequestInfo requestInfo = null)
{
string getUrl = baseUrl + "/" + groupName; // URL to retrieve the group
if (requestInfo != null) requestInfo.url = getUrl;
UnityWebRequest getRequest = UnityWebRequest.Get(getUrl);
getRequest.timeout = 60;
getRequest.certificateHandler = new CertificateHand(); // this is a custom certificate handler
// Send the GET request and wait for the response
yield return getRequest.SendWebRequest();
//rest of execution....
}
public class CertificateHand : CertificateHandler
{
protected override bool ValidateCertificate(byte[] certificateData)
{
return true;
}
}
This may require changes to the server rather than unity code, but I am only getting the issue with Unity and other API tools like Postman are working fine. I am confused why SSL is even being considered with a http request also.
Thank you