title: How to get Qt 5.8 working with OpenSSL on Windows
body: <p>I am trying to get Qt 5.8 working with OpenSSL on Windows, but every time I get a step forward I hit another bigger object.</p>
  
  <p><strong>Edit/Update:</strong> This error occurs only in debug mode!</p>
  
  <p>Here is my setup so far:</p>
  
  <ul>
  <li>Installed Qt 5.8</li>
  <li>Downloaded and compiled version of OpenSSL</li>
  <li>Transfer the small test project to MSVS2015</li>
  <li>Copied dll files (libeay32.dll and ssleay32.dll) to the application Directory</li>
  <li>SSL connection is now working fine</li>
  </ul>
  
  <p>But here is the problem:
  Every time I had a connection open whether with SSL or not I get an error by quitting the application. 
  Exception thrown at (ntdll.dll).</p>
  
  <p><img src="https://i.stack.imgur.com/L2NR6.png" alt="Error Message, Call Stack, ..."></p>
  
  <p>I tested my code with the Visual Leak Detector because I thought it was a Memory issue, but it does not solve my Problem.
  I rally have no clue where I should start anymore...</p>
  
  <p><a href="https://drive.google.com/file/d/0B4RkTj0UzvBAUWJjSi1KUFEzVjQ/view?usp=sharing" rel="nofollow noreferrer">Here is a small example in Qt Creator 4.2.1 which doesn't work either</a></p>
  
  <p>Here is my Code (it works fine with http, when I delete the OpenSSL dll's):</p>
  
  <pre><code>void InfoGatherer::getInfo(QString name)
  {
      // TODO: Search for the name and select right page
      QUrl url = QUrl(name);
      data.clear();
  
      QNetworkRequest *request = new QNetworkRequest(url);
      request-&gt;setRawHeader("User-Agent", userAgent);
  
      if (name.startsWith("https"))
      {
          QSslConfiguration sslConfiguration(QSslConfiguration::defaultConfiguration());
          sslConfiguration.setProtocol(QSsl::TlsV1_2OrLater);
          request-&gt;setSslConfiguration(sslConfiguration);
      }
      else
      {
          // TODO: Try to get https
      }
  
      reply = webCtrl-&gt;get(*request);
  
      connect(reply, SIGNAL(readyRead()), this, SLOT(onReadyRead()));
      connect(reply, SIGNAL(error(QNetworkReply::NetworkError)), this, SLOT(slotError(QNetworkReply::NetworkError)));
      connect(reply, SIGNAL(finished()), this, SLOT(onReplyFinished()));
  
      // Mem leaks (Visual Leak Detector)
      if(!name.startsWith("https"))
          webCtrl-&gt;deleteResource(*request);
  
      delete request;
  }
  
  void InfoGatherer::onReadyRead()
  {
      data.append(reply-&gt;readAll());
  }
  
  void InfoGatherer::slotError(QNetworkReply::NetworkError)
  {
      // TODO
      qWarning() &lt;&lt; "ErrorNo: " &lt;&lt; reply-&gt;error() &lt;&lt; "for url: " &lt;&lt; reply-&gt;url().toString();
      qDebug() &lt;&lt; "Request failed, " &lt;&lt; reply-&gt;errorString();
      qDebug() &lt;&lt; "Headers:" &lt;&lt; reply-&gt;rawHeaderList() &lt;&lt; "content:" &lt;&lt; reply-&gt;readAll();
  }
  
  void InfoGatherer::onReplyFinished()
  {
      QString html = QString(data);
  
      emit got_webpage(&amp;html);
  }
  </code></pre>
  
  <p>Qt detects the OpenSSL library correctly:</p>
  
  <pre><code>qDebug() &lt;&lt; "Support SSL:  " &lt;&lt; QSslSocket::supportsSsl()
          &lt;&lt; "\nLib Version Number: " &lt;&lt; QSslSocket::sslLibraryVersionNumber()
          &lt;&lt; "\nLib Version String: " &lt;&lt; QSslSocket::sslLibraryVersionString()
          &lt;&lt; "\nLib Build Version Number: " &lt;&lt; QSslSocket::sslLibraryBuildVersionNumber()
          &lt;&lt; "\nLib Build Version String: " &lt;&lt; QSslSocket::sslLibraryBuildVersionString();
  </code></pre>
  
  <ul>
  <li>Support SSL:   true </li>
  <li>Lib Version Number:  268443791 </li>
  <li>Lib Version String:  "OpenSSL 1.0.2h  3 May 2016" </li>
  <li>Lib Build Version Number:  268443791 </li>
  <li>Lib Build Version String:  "OpenSSL 1.0.2h  3 May 2016"</li>
  </ul>