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

QHttpPart hangs reading from a QIODevice at pos() != 0

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 4.8.0
    • Network
    • None

    Description

      When trying to send a QFile via HTTP using QHttpPart, the upload fails if the QFile has been seek()'d beforehand.

      It appears that QHttpPart uses QIODevice::size() to determine how much to read from the file, disregarding the current position of the QFile's read pointer, so if a seek() is executed, it will try to read more bytes than available, getting stuck in a loop.

      A minimal example is attached. Run passing any file as the first argument. It will loop forever trying to read some bytes at the end of the file. Commenting f->seek(1); makes it work.

      Attachments

        Issue Links

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

          Activity

            People

              peter-har Peter Hartmann
              jirauser19526 user-4f418 (Inactive)
              Votes:
              1 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes