This repository has been archived by the owner on Nov 1, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
The NSURL loading system has subtle and poorly documented behavior regarding caching. CocoaSPDY was not doing the right thing, thus there was no support for NSURLCache in the protocol. This patch adds basic support for both NSURLConnection and NSURLSession based requests. This is not yet a fully-featured client caching implementation. If the request specifies a NSURLRequest cachePolicy of: NSURLRequestUseProtocolCachePolicy - NSURL system does not provide a cached response to the protocol constructor. It is up to the protocol to load and validate the cached response. NSURLRequestReturnCacheDataElseLoad - NSURL system will provide the cached response, if available. The protocol is expected to validate the response, and load if not available or not valid. NSURLRequestReturnCacheDataDontLoad - NSURL system will provide the cached response, if available. The protocol is expected to validate the response. The protocol will not be loaded if no cached response is available, or if one is but is invalid, the protocol should not load the request. In the cases where the protocol has a cached response and it is valid, it is supposed to call URLProtocol:cachedResponseIsValid. CocoaSPDY was not doing this. Determining validity of the cached response is the job of the protocol, and a basic implementation has been provided here. CocoaSPDY also has to jump through some hoops whenever NSURLSession is being used, as Apple has not provided a way to get the NSURLSessionConfiguration and thus we cannot get the right NSURLCache. Fortunately we have already provided a workaround for this. SPDYMetadata has been extended to provide the source of the response.
- Loading branch information
Showing
16 changed files
with
1,220 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,3 +12,4 @@ build/ | |
xcuserdata/ | ||
contents.xcworkspacedata | ||
*.xccheckout | ||
*.gcda |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
11d02ec
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests are failing because NSURLSession on iOS 8 (simulator at least) does not seem to make the URLSession:dataTask:willCacheResponse:completionHandler: callback.