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

QNetworkReply sometimes emits spurious downloadProgress signal with invalid bytesTotal value for cached content

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P3: Somewhat important
    • None
    • 5.2.0
    • Network: HTTP
    • None
    • Ubuntu 14.04, Qt 5.2.0

    Description

      If we're trying to access some HTTP content which has been cached, we usually get a single QNetworkReply::downloadProgress(), with both the params (bytesReceived and bytesTotal) as 0.

      However, sometimes we get an extra QNetworkReply::downloadProgress() signal with bytesReceived as 0 and bytesTotal) as -1!

      I think this is incorrect behaviour.

      Ideally, both the parameters should reflect the actual content size. Even if this behaviour has been historically present, the -ve bytesTotal value seems clearly wrong.

      I'm attaching a small application for testing this behaviour.

      This was tested using Nginx. I used the following config section for sending back cache headers (put this in your /etc/nginx/sites-available/default):

      location /cached {
          root   /var/www/nginx-default;
          expires max;
          add_header Cache-Control public;
      }
      

      Create a cached folder under your webserver's root dir (/var/www/nginx-default in this case) and place the file you want cached there. The pragma above works for requests coming to the cached dir only.

      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
              mandeepsandhu Mandeep Sandhu
              Votes:
              0 Vote for this issue
              Watchers:
              6 Start watching this issue

              Dates

                Created:
                Updated:

                Gerrit Reviews

                  There are no open Gerrit changes