QUrl and QNetworkReply errors
-
I am getting bunch of errors (some breaking, some annoying) when trying to upload a file via ftp (Using Qt 5.4 32-bit on Windows 8.1 (64-bit) with MingW).
This code is problematic in number of ways:
//QString m_sUrl = "cloud.mysystem.info/"; //QString m_sFileName = "results.html"; //QNetworkAccessManager m_Manager; QUrl url(m_sURL + m_sFileName); url.setScheme("ftp"); url.setUserName(m_sLogin); url.setPassword(m_sPassword); url.setPort(21); QFile *file = new QFile(m_sFileName); if(file->open(QIODevice::ReadOnly)) { QNetworkReply *reply = m_Manager.put(QNetworkRequest(url), file); connect(reply, static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error), this, &OCMResults::error); connect(reply, &QNetworkReply::finished, reply, &QObject::deleteLater); connect(reply, &QNetworkReply::finished, file, &QObject::deleteLater); } else file->deleteLater();
I am experiencing 3 issues:
-
the URL is not correctly interpreted. The culprit is
url.setScheme("ftp"); //error code 301 (unknown protocol) when I do not specify it in the url but specify it as 'setScheme("ftp")' instead
When the protocol is directly in the URL string it works fine. Why is that?
-
I am getting bunch of SSL errors and neither ignoreSslErrors() connected to the reply or to the m_Manager works in preventing them.
QSslSocket: cannot resolve TLSv1_1_client_method QSslSocket: cannot resolve TLSv1_2_client_method QSslSocket: cannot resolve TLSv1_1_server_method QSslSocket: cannot resolve TLSv1_2_server_method QSslSocket: cannot resolve SSL_select_next_proto QSslSocket: cannot resolve SSL_CTX_set_next_proto_select_cb QSslSocket: cannot resolve SSL_get0_next_proto_negotiated
-
I am getting this for no apparent reason but it does not prevent the file to be correctly uploaded.
QIODevice::read: device not open
Only the first problem is actually app breaking because it then fails to connect and send the file. The second and third are just annoying.
Thanks for ideas/help!
-
-
Ok, I solved the first problem. It was due to me elsewhere using remove on the url string and me thinking the function returns modified copy while it modified the stirng itself.
One solved, two more to go...