Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QUrl and QNetworkReply errors
Forum Updated to NodeBB v4.3 + New Features

QUrl and QNetworkReply errors

Scheduled Pinned Locked Moved General and Desktop
2 Posts 1 Posters 1.1k Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Resurr3ctionR Offline
    Resurr3ctionR Offline
    Resurr3ction
    wrote on last edited by
    #1

    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:

    1. 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?

    1. 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
      
    2. 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!

    1 Reply Last reply
    0
    • Resurr3ctionR Offline
      Resurr3ctionR Offline
      Resurr3ction
      wrote on last edited by
      #2

      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...

      1 Reply Last reply
      0

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved