I access server-side secure information and send a bunch of cookies to the application on request. The problem is that some of the cookies are only sessions, and when I use:
[NSHTTPCookie requestHeaderFieldsWithCookies:[[NSHTTPCookieStorage sharedHTTPCookieStorage] cookiesForURL:[NSURL URLWithString:theCookie]]
it does not return session names named JSESSIONID and causes problems. If I NSLog is a full NSHTTPCookieStorage, it displays the session files so that they are there, I just cannot find a way to retrieve them from the repository. Also, I looked at the plie cookies and the session cookies are not stored there, but I assume this is because they are based on the session.
Any help is appreciated.
Edit: this is a snippet of what I get when I request all cookies:
<NSHTTPCookie version:0 name:@\"TheNameOfTheCookie\" value:@\"A variable number\" expiresDate:@\"(null)\" created:@\"301196844.000000\" sessionOnly:TRUE domain:@\"THE URL\" path:@\"/\" secure:FALSE comment:@\"(null)\" commentURL:@\"(null)\" portList:[]>
<NSHTTPCookie version:0 name:@\"JSESSIONID\" value:@\"A variable number\" expiresDate:@\"(null)\" created:@\"301196866.000000\" sessionOnly:TRUE domain:@\"The Same URL as above\" path:@\"/path\" secure:FALSE comment:@\"(null)\" commentURL:@\"(null)\" portList:[]>
Now, when I request cookies based on the URL of the above cookies, the first is returned and the second is not.
* note that you need to remove certain elements, they are as expected and are not relevant
source
share