Ephemeral sessions configurations do not store any cookies at all
| Originator: | tom | ||
| Number: | rdar://19852444 | Date Originated: | 16-Feb-2015 11:57 PM |
| Status: | Duplicate (15611809 - Closed) | Resolved: | 19-Feb-2015 00:25 AM |
| Product: | iOS SDK | Product Version: | 8.1 |
| Classification: | Serious Bug | Reproducible: | Always |
Summary: The http cookie storage that comes with an ephemeral NSURLSessionConfiguration does not allow the user to store cookies. Steps to Reproduce: 1. create a copy of [NSURLSessionConfiguration ephemeralSessionConfiguration] (let's call this copy 'config'). 2. ensure that config.HTTPCookieStorage is not nil (it isn't) 3. verify the config.HTTPCookieStorage.cookies.count == 0 4. create a correct NSHTTPCookie (let's call this 'cookie') 5. store the cookie in the cookie storage: [config.HTTPCookieStorage setCookie:cookie] Expected Results: config.HTTPCookieStorage.cookies.count > 0 Actual Results: config.HTTPCookieStorage.cookies.count == 0 Notes: The same applies when actually requesting data from a URL in a session using an ephemeral session configuration, with the response of that request setting a cookie. The cookie will not be present in the session/configuration after the request has successfully completed. The documentation does not mention the fact that ephemeral sessions cannot store cookies. In fact, it mentions: "For ephemeral sessions, the default value is a private cookie storage object that stores data in memory only, and is destroyed when you invalidate the session.". This seems not to be the case. Setting the values of HTTPShouldSetCookies to YES and/or HTTPCookieAcceptPolicy to NSHTTPCookieAcceptPolicyAlways has no effect on this behavior. This was tested both in the simulator as on an iPhone6 running iOS8.1.2. In attachment a project that shows this behavior.
Comments
Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!