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

QNetworkRequest::CacheLoadControlAttribute PreferNetwork does not do network request

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: P3: Somewhat important P3: Somewhat important
    • None
    • 6.8.3
    • Network: HTTP
    • None
    • macOS, Windows

      QNetworkAccessManager doesn't request a resource when a cache is set.

      QNetworkAccessManager::setCache

      I expect that when using QNetworkRequest::CacheLoadControlAttribute with PreferNetwork, I should be able to customize the cache behavior or have it handled automatically if the request header "If-Modified-Since" is set.

      By "customize," I mean receiving a status code 304 when QNetworkReply::finished is emitted.

      However, I only receive status 304 when I detach the cache from QNetworkAccessManager.

      For an example demonstrating this issue, please see imagefetcher.cpp. I've added comments within the file.

      NetworkCacheProblem.zip

        1. NetworkCacheProblem.zip
          6 kB
          Vasyl Hryhorzhevskyi
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

            manordheim Mårten Nordheim
            vasyl Vasyl Hryhorzhevskyi
            Votes:
            2 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:

                There are no open Gerrit changes