Details
-
Bug
-
Resolution: Duplicate
-
P2: Important
-
None
-
5.7.0
-
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
- duplicates
-
QTBUG-61300 FollowRedirectsAttribute messes up some response headers
- Closed
- is required for
-
QTBUG-63438 Improve (or even implement) the correct redirects support
- Closed