Changeset 188690 in webkit
- Timestamp:
- Aug 20, 2015 10:47:08 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r188686 r188690 1 2015-08-20 Chris Dumez <cdumez@apple.com> 2 3 [Cocoa] Treat Epoch as invalid value for "Last-Modified" header 4 https://bugs.webkit.org/show_bug.cgi?id=148162 5 rdar://problem/22330837 6 7 Reviewed by Antti Koivisto. 8 9 Add better layout test coverage for using the "Last-Modified" header to 10 compute heuristic freshness. In particular, it adds coverage for the 11 following values: Epoch, malformed date. 12 13 * http/tests/cache/disk-cache/disk-cache-last-modified-expected.txt: Added. 14 * http/tests/cache/disk-cache/disk-cache-last-modified.html: Added. 15 New test. 16 17 * http/tests/cache/disk-cache/resources/cache-test.js: 18 (makeHeaderValue): 19 makeHeaderValue() was not resolving 'now(-1000)' into a date. This means that the 20 tests using it would end up sending an invalid "Last-Modified" header which our 21 networking code was translating to Epoch. We now ignore Epoch as Last-Modified 22 value for computing heuristic freshness to not cache due to malformed headers. 23 1 24 2015-08-20 Eric Carlson <eric.carlson@apple.com> 2 25 -
trunk/LayoutTests/http/tests/cache/disk-cache/resources/cache-test.js
r188468 r188690 34 34 if (value == 'now(100)') 35 35 return (new Date(new Date().getTime() + serverClientTimeDelta + 100 * 1000)).toUTCString(); 36 if (value == 'now(-1000)') 37 return (new Date(new Date().getTime() - serverClientTimeDelta - 1000 * 1000)).toUTCString() 36 38 if (value == 'unique()') 37 39 return "" + uniqueIdCounter++; -
trunk/Source/WebCore/ChangeLog
r188687 r188690 1 2015-08-20 Chris Dumez <cdumez@apple.com> 2 3 [Cocoa] Treat Epoch as invalid value for "Last-Modified" header 4 https://bugs.webkit.org/show_bug.cgi?id=148162 5 rdar://problem/22330837 6 7 Reviewed by Antti Koivisto. 8 9 Ignore "Last-Modified" header when computing heuristic freshness if it 10 is Epoch. CFNetwork currently converts a malformed date for Last-Modified 11 into Epoch so there is no way for us to distinguish Epoch from invalid 12 input. Without this, we would end up with cached resources that have a 13 giant lifetime (> 4 years) due to a malformed HTTP header. 14 15 Some Websites (e.g. www.popehat.com) also wrongly return Epoch as 16 Last-Modified value and we would end up caching it overly aggressively. 17 Now that we consider Epoch as an invalid value for Last-Modified, it will 18 also work around this content bug. 19 20 Test: http/tests/cache/disk-cache/disk-cache-last-modified.html 21 22 * platform/network/ResourceResponseBase.cpp: 23 (WebCore::ResourceResponseBase::lastModified): 24 1 25 2015-08-19 Brian Burg <bburg@apple.com> 2 26 -
trunk/Source/WebCore/platform/network/ResourceResponseBase.cpp
r183901 r188690 426 426 if (!m_haveParsedLastModifiedHeader) { 427 427 m_lastModified = parseDateValueInHeader(m_httpHeaderFields, HTTPHeaderName::LastModified); 428 #if PLATFORM(COCOA) 429 // CFNetwork converts malformed dates into Epoch so we need to treat Epoch as 430 // an invalid value (rdar://problem/22352838). 431 const std::chrono::system_clock::time_point epoch; 432 if (m_lastModified && m_lastModified.value() == epoch) 433 m_lastModified = Nullopt; 434 #endif 428 435 m_haveParsedLastModifiedHeader = true; 429 436 }
Note: See TracChangeset
for help on using the changeset viewer.