WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
152424
Cache redirects as separate entries
https://bugs.webkit.org/show_bug.cgi?id=152424
Summary
Cache redirects as separate entries
Antti Koivisto
Reported
2015-12-18 06:48:05 PST
We are currently caching redirect chains. This has correctness issues and can be inefficient in cases where multiple URLs redirect to the same destination.
Attachments
patch
(46.75 KB, patch)
2015-12-18 08:29 PST
,
Antti Koivisto
achristensen
: review+
Details
Formatted Diff
Diff
View All
Add attachment
proposed patch, testcase, etc.
Antti Koivisto
Comment 1
2015-12-18 08:29:17 PST
Created
attachment 267630
[details]
patch
WebKit Commit Bot
Comment 2
2015-12-18 08:31:27 PST
Attachment 267630
[details]
did not pass style-queue: ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:346: Extra space before ( in function call [whitespace/parens] [4] ERROR: Source/WebKit2/NetworkProcess/cache/NetworkCache.cpp:423: Extra space before ( in function call [whitespace/parens] [4] Total errors found: 2 in 19 files If any of these errors are false positives, please file a bug against check-webkit-style.
Alex Christensen
Comment 3
2015-12-18 10:38:09 PST
Comment on
attachment 267630
[details]
patch View in context:
https://bugs.webkit.org/attachment.cgi?id=267630&action=review
r=me one these questions are addressed.
> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:185 > - if (NetworkCache::singleton().isEnabled()) > + if (canUseCache(request))
Did you change all uses of NetworkCache::singleton().isEnabled to canUseCache? This seems like a very important change that we should've done long ago.
> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:-336 > - // Make sure we don't keep a stale entry in the cache.
Why don't we need to remove any cache entries here any more?
> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:402 > +#if ENABLE(NETWORK_CACHE)
You might need an #else UNUSED_PARAM(request); And maybe it should be called something like originalRequest.
> Source/WebKit2/NetworkProcess/NetworkResourceLoader.cpp:531 > +void NetworkResourceLoader::dispatchWillSendRequestForCacheEntry(std::unique_ptr<NetworkCache::Entry> entry)
This is only called from one place and might not need its own function unless you plan to use it from other places in the future.
> LayoutTests/http/tests/cache/disk-cache/disk-cache-redirect-expected.txt:10 > +response source: Disk cache
How is the first response from the Disk cache?
> LayoutTests/http/tests/cache/disk-cache/disk-cache-redirect.html:17 > + { responseHeaders: {'Cache-control': 'max-age=0' } }, > + { responseHeaders: {'Cache-control': 'max-age=100' } },
If I'm correct, the first cache entry expires immediately, and the second cache entry does not expire immediately, so we test making a request for a cache entry that has expired. Why don't we make another request after the second one to test making a request for a cache entry that has not expired?
Antti Koivisto
Comment 4
2015-12-18 10:47:13 PST
(In reply to
comment #3
)
> Did you change all uses of NetworkCache::singleton().isEnabled to > canUseCache? This seems like a very important change that we should've done > long ago.
Yeah, everywhere in NetworkResourceLoader.
> Why don't we need to remove any cache entries here any more?
I don't think so. That case was there for expired redirect chains. Now redirects expire like other cache entries.
> This is only called from one place and might not need its own function > unless you plan to use it from other places in the future.
It looked nicer like this in the call site.
> > LayoutTests/http/tests/cache/disk-cache/disk-cache-redirect-expected.txt:10 > > +response source: Disk cache > > How is the first response from the Disk cache?
301 Permanent Redirect is cacheable by default unless other headers say otherwise. 302, 303 and 303 are not cached by default.
> > > LayoutTests/http/tests/cache/disk-cache/disk-cache-redirect.html:17 > > + { responseHeaders: {'Cache-control': 'max-age=0' } }, > > + { responseHeaders: {'Cache-control': 'max-age=100' } }, > > If I'm correct, the first cache entry expires immediately, and the second > cache entry does not expire immediately, so we test making a request for a > cache entry that has expired. Why don't we make another request after the > second one to test making a request for a cache entry that has not expired?
Thase are independent test cases (or actually used to generate individual test cases by generating all header permutations). Each test is loaded multiple times to see if it gets faced. You see the actual cases in the test output (the first warmup load doesn't generate output). Thanks for review.
Antti Koivisto
Comment 5
2015-12-19 05:27:32 PST
https://trac.webkit.org/r194313
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug