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

QNetworkReply::canReadLine return false before read

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P1: Critical
    • None
    • 6.5.0
    • Network: HTTP
    • None

    Description

      Since Qt6.5 (well, after 6.2.4), calling canreadline on a QNetworkReply returns false before reading. This code prints false and true.

         QNetworkRequest request( QUrl( "https://www.test.com" ) ) ;
         QNetworkAccessManager networkAccessManager ;
         auto reply = networkAccessManager.get( request ) ;
         QObject::connect( reply, &QIODevice::readyRead,
            [reply]()
            {
                qDebug() << reply->canReadLine() ;
                reply->peek( 1 ) ;
                qDebug() << reply->canReadLine() ;
            } ) ;
      

      Seems to be related to :

      Peeking one character is a workaround, but I think data should be decompressed before any call to canreadline.

      Attachments

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

        Activity

          People

            manordheim Mårten Nordheim
            mjtdcp Mathieu Joubert
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes