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

FollowRedirectsAttribute and downloadProgress slot bug

    XMLWordPrintable

Details

    • Bug
    • Resolution: Duplicate
    • P2: Important
    • None
    • 5.7.0
    • Network
    • None
    • Windows 7, PyQt 5.7

    Description

      I have found another bug with FollowRedirectsAttribute. When FollowRedirectsAttribute is True and you try to download a file that has a redirect, the downloadProgress slot 'bytesTotal' variable is always -1 (unknown) for the course of the entire download.

      The first HTTP 302 response, has a Content-Length header value for the size of the HTTP 302 response. After the redirect to the correct page containing the actual download, the Content-Length header value is the correct size for the file to be downloaded.

      This was checked in Wireshark. If I use the redirected URL as the QNetworkRequest URL, Qt correctly knows the size of the file and bytesTotal is correct.

      My best guess is that behind the scenes Qt is using the original HTTP 302 response Content-Length instead of the redirected URL's response header.

      I have attached an example demonstrating the problem in PyQt 5.7 / Python 3. By default it's set to the URL that gets redirected. Just change url1 to url2 for the QNetworkRequest to see how it handles it differently.

      Attachments

        Issue Links

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

          Activity

            People

              tpochep Timur Pocheptsov
              wallboy Adam W
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes