Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement CachedURLResponse. #2245

Merged
merged 3 commits into from
Jun 12, 2019

Conversation

drodriguez
Copy link
Contributor

@drodriguez drodriguez commented May 9, 2019

Simple implementation for CachedURLResponse. The type seems to mostly be
a data container with little behaviour.

Implement the missing equality and hashing for URLResponse, which is
used by CachedURLResponse.

Implement tests for CachedURLResponse and the missing tests for
equality and hashing in URLResponse.

https://bugs.swift.org/browse/SR-10373

@pushkarnk
Copy link
Member

@swift-ci please test

@millenomi
Copy link
Contributor

I need to double-check that the coding here is compatible with Darwin's, and this definitely needs coding fixtures.

@drodriguez
Copy link
Contributor Author

@millenomi: by coding fixtures you mean the files in TestFoundation/Fixtures/macOS-10.14/? Are those encoding results from the Darwin/Obj-C implementation in macOS? Does that mean that the encoding/decoding has to work between implementations? Are there some tricks to get this right from the “outside”? (I don’t have access to the original source code :D)

@drodriguez drodriguez requested a review from millenomi May 20, 2019 18:39
@drodriguez
Copy link
Contributor Author

@millenomi can you clarify your previous comment and how can I improve this PR? I would like to keep going with URLCache, but I need this piece first. Thanks!

@millenomi
Copy link
Contributor

@drodriguez sorry for the radio silence — I would like to merge #2289 before letting other URLSession work continue for obvious reasons.

@drodriguez
Copy link
Contributor Author

That's awesome work. I will hold this and other URL related pieces until that other PR is in place. Tell me if I can help in anything.

return nil
}

guard let data = aDecoder.decodeObject(of: NSData.self, forKey: "Data") else {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you remove the coding-related parts of this patch? The coding testing isn't done like this anymore (see FixtureValues.swift and grep the codebase for codingRoundtrip) and this isn't compatible with Darwin's encoding.

@millenomi
Copy link
Contributor

@drodriguez Are you interested in keeping this going? Otherwise, I will commandeer this, if that's okay with you.

@drodriguez
Copy link
Contributor Author

@millenomi: it is fine with me if you want to take command of this. I haven’t had time to came back to this and apply your previous comment. Thanks!

@millenomi
Copy link
Contributor

@swift-ci please test

@millenomi
Copy link
Contributor

Basically: we can store these things via coding if we so desire via an internal helper class; but if we're not publicly able to load and store archives that interoperate with Darwin, I'm not allowing encoding/decoding at all.

@drodriguez
Copy link
Contributor Author

@millenomi you might want to remove the test that checks NSCoding compliance.

@millenomi
Copy link
Contributor

Whoops, good point.

drodriguez and others added 3 commits May 30, 2019 13:11
Simple implementation for CachedURLResponse. The type seems to mostly be
a data container with little behaviour.

Implement the missing equality and hashing for URLResponse, which is
used by CachedURLResponse.

Implement tests for CachedURLResponse and the missing tests for
equality and hashing in URLResponse.
@millenomi millenomi force-pushed the cached-url-response branch from 5e0718f to 3dd622b Compare May 30, 2019 20:18
@millenomi
Copy link
Contributor

@swift-ci please test

@drodriguez drodriguez merged commit 37ffb95 into swiftlang:master Jun 12, 2019
@drodriguez drodriguez deleted the cached-url-response branch June 12, 2019 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants