Details
-
Task
-
Resolution: Unresolved
-
P2: Important
-
None
-
None
-
None
Description
Currently there are 4 values in the enum, AlwaysNetwork, PreferNetwork, PreferCache and AlwaysCache.
The problem is that documentation[0] and implementation don't match, which has led to a few bug-reports [1][2].
All of the logic relevant to this issue resides at [3].
In short: PreferNetwork and PreferCache are not considered, at all. They always behave the same way.
For both options Qt will check if certain Cache-Control values are set which demand us to query the source for changes, and if those are not set Qt will check if the cached content has expired, and if not, will return the cached content.
This behavior matches neither of the two's documentation.
There were patches written separately to make the code match their documentation counter-parts[4][5], but then a majority of the code (which implements actual sane behavior) is no longer used!
It's unclear what the best solution is in this situation, so this issue is created in hopes of arriving at a good solution.
[0]: https://doc.qt.io/qt-6/qnetworkrequest.html#CacheLoadControl-enum
[1] QTBUG-81318
[2] QTBUG-102352
[3] https://github.com/qt/qtbase/blob/301f0a6fb025968ee73c74b8dffea1e7fe6f67e0/src/network/access/qnetworkreplyhttpimpl.cpp#L496
[4] https://codereview.qt-project.org/c/qt/qtbase/+/296092
[5] https://codereview.qt-project.org/c/qt/qtbase/+/406957
Attachments
Issue Links
- blocks
-
QTBUG-102352 QNetworkRequest::PreferCache does not behave as expected
- Reported
-
QTBUG-81318 QNetworkRequest::CacheLoadControlAttribute PreferNetwork still loads from cache even if resource was modified on server
- Open