Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-65755

No reply or network error returned from QNetworkAccessManager GET request.

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • P3: Somewhat important
    • None
    • 5.10.0
    • Network
    • None
    • Windows 7 64bit

      Qt 5.10 msvc2015 64bit

    Description

      I'm making a GET request on a local address to get data from an Arduino(ESP8266) board. The board hosts a server, and sends to the client the content of a flle in its filesystem. For reference, this is the code on the Arduino board: 

       

      WiFiServer server;
      //...
      WiFiClient client = server.available();  
      //...
      client.print("HTTP/1.1 200 OK\n\n"); // http header
      client.write(file);                  // local file
      

       The content of the file is sent as response to the client. 

       

      This is the Qt code, the download starts when a push button is clicked in the gui: 

      MainWindow::MainWindow(QWidget *parent) :
          QMainWindow(parent),
          ui(new Ui::MainWindow),
          nam(new QNetworkAccessManager)
      {
          ui->setupUi(this);
          connect(nam,&QNetworkAccessManager::finished,[](QNetworkReply* r){
              qDebug()<<QString(r->readAll());
              r->deleteLater();
          });
      }
      
      void MainWindow::on_pushButton_clicked()
      {
          QNetworkReply* r = nam->get(QNetworkRequest(QUrl("http://192.168.1.103")));
          connect(r,static_cast<void (QNetworkReply::*)(QNetworkReply::NetworkError)>(&QNetworkReply::error),[](QNetworkReply::NetworkError err){
              qDebug()<<err;
          });    
      }
      

       

      I found out that if the file has more than 32763 characters, qt's QNetworkAccessManager::finished is never fired anymore, and also QNetworkReply::NetworkError is never triggered. Chrome and curl have no problem loading the response(even with much more characters), so the problem is not in the Arduino code.

      The mentioned maximum number of characters 32763 is quite close to 2^15 so it seems it's not a random value.

       

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            tpochep Timur Pocheptsov
            cpper anders stoian
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes