Apply patches by Lubomir Rintel <lubo.rintel@gooddata.com> to enable cookies

git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/base/trunk@34746 72102866-910b-0410-8b05-ffd578937521
This commit is contained in:
rfm 2012-02-08 17:01:31 +00:00
parent 28d4991154
commit 88d0763339
6 changed files with 105 additions and 14 deletions

View file

@ -976,6 +976,26 @@ static NSURLProtocol *placeholder = nil;
{
NSURLCacheStoragePolicy policy;
/* Get cookies from the response and accept them into
* shared storage if policy permits
*/
if ([this->request HTTPShouldHandleCookies] == YES
&& [_response isKindOfClass: [NSHTTPURLResponse class]] == YES)
{
NSDictionary *hdrs;
NSArray *cookies;
NSURL *url;
url = [_response URL];
hdrs = [_response allHeaderFields];
cookies = [NSHTTPCookie cookiesWithResponseHeaderFields: hdrs
forURL: url];
[[NSHTTPCookieStorage sharedHTTPCookieStorage]
setCookies: cookies
forURL: url
mainDocumentURL: [this->request mainDocumentURL]];
}
/* Tell the client that we have a response and how
* it should be cached.
*/