QNetworkAccessManager: UnknownNetworkError in Windows
-
Hi,
the code listed below works well under Linux and produces an unknown network error under Windows.
I have installed the latest openssl on the Windows box.
Help is highly appreciated, thanks in advance.
Brgds
Axelconst string url = "https://mySecretUrl.at/apikey"; QNetworkAccessManager am; QNetworkRequest nr(QUrl(url.c_str())); nr.setRawHeader("apikey",userkey.c_str()); QNetworkReply* r = am.get(nr); QEventLoop loop; QObject::connect(r, &QNetworkReply::finished, &loop, &QEventLoop::quit); loop.exec(); resultBody = QString::fromUtf8(r->readAll()).toStdString(); bool ret = (r->error()==QNetworkReply::NoError); auto error = r->error(); delete r;
-
@AxelVienna Please add error handling.Especially https://doc.qt.io/qt-5/qnetworkaccessmanager.html#sslErrors , https://doc.qt.io/qt-5/qnetworkreply.html#sslErrors and https://doc.qt.io/qt-5/qnetworkreply.html#errorOccurred
You probably don't have SSL libs (you're accessing a HTTPS URL). -
@jsulm: Thanks for pointing to this direction.
Installing OpenSSL from https://slproweb.com/download/Win64OpenSSL-1_1_1k.msi did the trick.
My problem was that I had installed the light install version which obviously has no headers included.
Issue solved.