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. Could download a file via HTTPS by browser, but not by a Qt-app.

Could download a file via HTTPS by browser, but not by a Qt-app.

Scheduled Pinned Locked Moved Unsolved General and Desktop
2 Posts 2 Posters 282 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.
  • P Offline
    P Offline
    prog04116
    wrote on last edited by
    #1

    There is a URL containing JPEG file.

    Browsers download and show it, but a Qt-app doesn't.

    Initially it worked several times, but then:

    QNetworkReply::NetworkError 99 (QNetworkReply::UnknownNetworkError), reply->errorString () (one of):

    1. "Connection timed out",
    2. "Unable to write",
    3. "Connection closed"

    Sometimes it seems to download, but fails converting into JPEG:

    QPixmap::loadFromData() == false

    Source code:

        QNetworkAccessManager *nam = getQNetworkAccessManager ();
        QNetworkRequest nrq = QNetworkRequest (QUrl (url));
    
        nrq.setHeader (QNetworkRequest::UserAgentHeader,  // did not help
                       "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.43 (KHTML, "
                       "like Gecko) Chrome/95.0.4638.69 Safari/537.36 OPR/81.0.4196.54");
    
        QNetworkReply *reply = nam->get (nrq);
    
        connect (reply, &QIODevice::readyRead, rcv, od);
        connect (reply, &QNetworkReply::errorOccurred, rcv, oe);
        connect (reply, &QNetworkReply::sslErrors, rcv, ose);
    
    
    qDebug() << QSslSocket::sslLibraryBuildVersionString();: "OpenSSL 1.1.1g  21 Apr 2020"
    qDebug() << QSslSocket::supportsSsl();: true
    qDebug() << QSslSocket::sslLibraryVersionString();: "OpenSSL 1.1.1g  21 Apr 2020"
    

    There are no SSL-errors, onlyQNetworkReply::errorOccurred().

    I also asked my firewall to allow the connection.

    Will you please help me?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      Did you check what is happening with a tool like WireShark ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      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