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

QNetworkAccessManager can't decompress response data that received from HTTP server automatically

    XMLWordPrintable

Details

    • Bug
    • Resolution: Invalid
    • Not Evaluated
    • None
    • 4.7.2
    • Network
    • None
    • QT SDK 4.7.2

    Description

      we need to receive http response data from server side, and the data is compressed in GZIP format, currently the response data is delivered to client application in compressed format, not decompressed by QNAM automatically. some code example listed as below:

      before send the request to http server, the header to ask server use gzip compression was set:

      const QString KAcceptEncoding( "gzip" );
      aNetworkRequest.setRawHeader("Accept-Encoding", KAcceptEncoding.toAscii());
      
      then response was processed as below:
      
      void onFinished(QNetworkReply *aNwkReply)
      {
          if(aNwkReply->error() != QNetworkReply::NoError)
          {
              LOG_FORMAT("Error received: %s", STRING2CHAR(aNwkReply->errorString()));
              emit errorNotified(true);
              return;
          }
          
          mNwkReply = aNwkReply;
          
          QByteArray response1 = mNwkReply->readAll();
      
          mNwkReply->deleteLater();
          mNwkReply = NULL;
          
          //here the data read into variable response1 is still in compressed format.
      }
      

      Attachments

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

        Activity

          People

            earthdomain Earth Domain (Inactive)
            ch07018 Chu Junhui
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes