-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Implement URLSessionConfiguration.ephemeral #2125
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -119,7 +119,15 @@ open class URLSessionConfiguration : NSObject, NSCopying { | |
open class var `default`: URLSessionConfiguration { | ||
return URLSessionConfiguration() | ||
} | ||
open class var ephemeral: URLSessionConfiguration { NSUnimplemented() } | ||
|
||
open class var ephemeral: URLSessionConfiguration { | ||
// Return a new ephemeral URLSessionConfiguration every time this property is invoked | ||
// TODO: urlCache and urlCredentialStorage should also be ephemeral/in-memory | ||
// URLCache and URLCredentialStorage are still unimplemented | ||
let ephemeralConfiguration = URLSessionConfiguration() | ||
ephemeralConfiguration.httpCookieStorage = HTTPCookieStorage.ephemeralStorage() | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just printed all the public property of ephemeral configuration, and noticed some minor discrepancies of values between the existing implementation and yours,
Hope this helps. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's right. The There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @karthikkeyan I checked the value for
|
||
return ephemeralConfiguration | ||
} | ||
|
||
open class func background(withIdentifier identifier: String) -> URLSessionConfiguration { NSUnimplemented() } | ||
|
||
|
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.
I am still in the learning phase, ignore this comment if it is wrong,
After looking the code from
TestHTTPCookieStorage.test_cookieInXDGSpecPath()
, it seems you are missing,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.
@karthikkeyan For ephemeral storage, we don't persist the cookies in a file. The XDG spec standardises some common locations on the file system. It's not relevant if we don't want to store cookies to a file. I hope I got your question right.
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.
Sorry for the late response, the statement that creates the cookie folder's path, is inside
if !isEphemeral
We can leave that discussion for different PR as the code is not relevant to the intention of this PR.