Browse Source

Initialize SSL when making a HTTP Request and URHO3D_SSL is defined (#2629)

* Initialize SSL when making a HTTP Request and URHO3D_SSL is defined

* Simplify SSL initialization.
stievie 5 years ago
parent
commit
67389ec2bd
1 changed files with 9 additions and 0 deletions
  1. 9 0
      Source/Urho3D/Network/HttpRequest.cpp

+ 9 - 0
Source/Urho3D/Network/HttpRequest.cpp

@@ -53,6 +53,15 @@ HttpRequest::HttpRequest(const String& url, const String& verb, const Vector<Str
 
 
     URHO3D_LOGDEBUG("HTTP " + verb_ + " request to URL " + url_);
     URHO3D_LOGDEBUG("HTTP " + verb_ + " request to URL " + url_);
 
 
+#ifdef URHO3D_SSL
+    static bool sslInitialized = false;
+    if (!sslInitialized)
+    {
+        mg_init_library(MG_FEATURES_TLS);
+        sslInitialized = true;
+    }
+#endif
+
 #ifdef URHO3D_THREADING
 #ifdef URHO3D_THREADING
     // Start the worker thread to actually create the connection and read the response data.
     // Start the worker thread to actually create the connection and read the response data.
     Run();
     Run();