qt5base-lts/tests/auto
Dong-Heon Jung 992baedb8b QNetworkDiskCache: fix expiration calculation heuristic with Last-Modified time
Heuristic with last-modified time in Qt has some problems.
1) Remove redundant expirationDate.isInvalid() check
expirationDate.isInvalid is already checked. So I removed.

2) Add dateHeader.isInvalid() check
The dateHeader is used in expiration calculation.
I add invalid check for the dateHeader.
*. The dateHeader is the origin server's Date

3) Change diff time calculation.
The expirationDate is calculated with time diff.

Previous calculation is
// The lastModified is earlier than the currentDateTime.
// The diff has negative value.
int diff = currentDateTime.secsTo(lastModified);
// The expirationDate is earlier than lastModified
// , currentDateTime and dateHeader.
expirationDate = lastModified.addSecs(diff / 10);
*. currentDateTime: current time
*. lastModified: last modified date in server

It means that files are not cached with the heuristic.

I changed diff calculation.
int diff = lastModified.secsTo(dateHeader);
freshness_lifetime = diff / 10; // RFC 2616 13.2.4

4) httpRequest.headerField setting
If current_age is larger than 1 day, the cache MUST attach Warning 113.
*. The current_age is value of age in header
   or elapsed time from dateHeader in Qt source code.

Previous code does not check current_age is larger than 1 day correctly.
// dt = 1970-01-01T00:00:00 + current_age
dt.setTime_t(current_age);
// currentDateTime is much bigger than 1970-01-01T00:00:00
if (dt.daysTo(currentDateTime) > 1)

Task-number: QTBUG-40836
Change-Id: I4b00c3b287e6fafeea6b02681533fe75a198247e
Reviewed-by: Jung Dong-Heon <dongheon.jung@lge.com>
Reviewed-by: Peter Hartmann <phartmann@blackberry.com>
2014-09-12 17:51:48 +02:00
..
android Android: Add uninstall option. 2014-07-21 20:38:00 +02:00
bic/data test: Add 5.1.0 bic data for linux-gcc-ia32 2013-07-08 21:47:36 +02:00
cmake Fix cmake-test for Dynamic OpenGL. 2014-08-05 06:34:33 +02:00
compilerwarnings/data Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
concurrent QtConcurrent::run: allow to select the thread pool on which to run the task 2014-08-05 18:05:04 +02:00
corelib QVariant::compare shouldn't return match when QVariant::cmp does not 2014-09-11 23:05:35 +02:00
dbus tst_qdbusabstractadaptor: Reduce qWait() usage. 2014-08-19 04:09:24 +02:00
gui Add an option to share between TLWs 2014-09-10 13:36:27 +02:00
guiapplauncher Update the documentation after moving examples. 2011-07-05 21:19:08 +02:00
installed_cmake Add a unit test for testing Qt in its install location. 2013-07-02 23:08:54 +02:00
network QNetworkDiskCache: fix expiration calculation heuristic with Last-Modified time 2014-09-12 17:51:48 +02:00
opengl Merge remote-tracking branch 'origin/stable' into dev 2014-05-06 16:50:03 +02:00
other Accessibility: Improve line boundary helper functions 2014-09-04 14:50:32 +02:00
printsupport QPrinter - Expect failure of QPrinter page size test 2014-03-17 13:46:29 +01:00
shared iOS: Fix compilation of some basic tests 2014-01-17 11:04:43 +01:00
sql tst_qsqlthread: Add debug about when threads finished. 2014-08-23 13:50:27 +02:00
testlib Merge remote-tracking branch 'origin/stable' into dev 2014-05-22 07:46:17 +02:00
tools add priority sorting to $$resolve_depends() 2014-07-30 10:31:53 +02:00
widgets GraphicsView: Fix resolvePalette() for QGraphicsItem's children 2014-09-05 13:12:21 +02:00
xml Speed up tst_QXmlSimpleReader. 2014-05-08 16:06:11 +02:00
auto.pro iOS: Enable building of basic tests 2014-01-22 12:35:17 +01:00
network-settings.h network test settings: support newer FTP server versions 2013-08-28 12:45:34 +02:00
qtest-config.h Update copyright year in Digia's license headers 2013-01-18 09:07:35 +01:00
test.pl Whitespace cleanup: remove trailing whitespace 2013-03-16 20:22:50 +01:00