Title: [199090] trunk/Source/WebKit2
- Revision
- 199090
- Author
- [email protected]
- Date
- 2016-04-05 18:37:07 -0700 (Tue, 05 Apr 2016)
Log Message
Fix Range requests when not using the NetworkCache with NetworkSession
https://bugs.webkit.org/show_bug.cgi?id=156036
rdar://problem/25334939
Patch by Alex Christensen <[email protected]> on 2016-04-05
Reviewed by Sam Weinig.
* NetworkProcess/cocoa/NetworkSessionCocoa.mm:
(-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]):
Don't cache any responses with Content-Range headers to work around rdar://problem/20001985.
This is similar to the workaround in shouldCacheResponse in WebCoreNSURLSession.mm
(WebKit::NetworkSession::NetworkSession):
If we are using the NetworkCache, then don't use CFNetwork's cache.
Modified Paths
Diff
Modified: trunk/Source/WebKit2/ChangeLog (199089 => 199090)
--- trunk/Source/WebKit2/ChangeLog 2016-04-06 01:36:01 UTC (rev 199089)
+++ trunk/Source/WebKit2/ChangeLog 2016-04-06 01:37:07 UTC (rev 199090)
@@ -1,3 +1,18 @@
+2016-04-05 Alex Christensen <[email protected]>
+
+ Fix Range requests when not using the NetworkCache with NetworkSession
+ https://bugs.webkit.org/show_bug.cgi?id=156036
+ rdar://problem/25334939
+
+ Reviewed by Sam Weinig.
+
+ * NetworkProcess/cocoa/NetworkSessionCocoa.mm:
+ (-[WKNetworkSessionDelegate URLSession:dataTask:willCacheResponse:completionHandler:]):
+ Don't cache any responses with Content-Range headers to work around rdar://problem/20001985.
+ This is similar to the workaround in shouldCacheResponse in WebCoreNSURLSession.mm
+ (WebKit::NetworkSession::NetworkSession):
+ If we are using the NetworkCache, then don't use CFNetwork's cache.
+
2016-04-05 Brent Fulgham <[email protected]>
Correct applicationWillTerminate logic for ResourceLoadStatistics
Modified: trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm (199089 => 199090)
--- trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-04-06 01:36:01 UTC (rev 199089)
+++ trunk/Source/WebKit2/NetworkProcess/cocoa/NetworkSessionCocoa.mm 2016-04-06 01:37:07 UTC (rev 199090)
@@ -31,6 +31,7 @@
#import "CustomProtocolManager.h"
#import "DataReference.h"
#import "Download.h"
+#import "NetworkCache.h"
#import "NetworkLoad.h"
#import "NetworkProcess.h"
#import "SessionTracker.h"
@@ -125,6 +126,16 @@
}
}
+- (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask willCacheResponse:(NSCachedURLResponse *)proposedResponse completionHandler:(void (^)(NSCachedURLResponse * _Nullable cachedResponse))completionHandler
+{
+ // FIXME: remove if <rdar://problem/20001985> is ever resolved.
+ if ([proposedResponse.response respondsToSelector:@selector(allHeaderFields)]
+ && [[(id)proposedResponse.response allHeaderFields] objectForKey:@"Content-Range"])
+ completionHandler(nil);
+ else
+ completionHandler(proposedResponse);
+}
+
- (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler
{
auto storedCredentials = session.configuration.URLCredentialStorage ? WebCore::StoredCredentials::AllowStoredCredentials : WebCore::StoredCredentials::DoNotAllowStoredCredentials;
@@ -312,6 +323,9 @@
NSURLSessionConfiguration *configuration = configurationForType(type);
+ if (NetworkCache::singleton().isEnabled())
+ configuration.URLCache = nil;
+
if (auto& data = ""
configuration._sourceApplicationAuditTokenData = (NSData *)data.get();
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes