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

QNetworkReply::canReadLine return false before read

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:

                There are no open Gerrit changes