bug-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[PATCH 1/4] Parse cookies from response


From: Lubomir Rintel
Subject: [PATCH 1/4] Parse cookies from response
Date: Mon, 6 Feb 2012 14:39:16 +0100

* Source/NSURLProtocol.m (_got): Parse cookies from response
---
 Source/NSURLProtocol.m |   14 ++++++++++++++
 1 files changed, 14 insertions(+), 0 deletions(-)

diff --git a/Source/NSURLProtocol.m b/Source/NSURLProtocol.m
index bbafbbd..16423eb 100644
--- a/Source/NSURLProtocol.m
+++ b/Source/NSURLProtocol.m
@@ -976,6 +976,20 @@ 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)
+                {
+                  [[NSHTTPCookieStorage sharedHTTPCookieStorage]
+                     setCookies:[NSHTTPCookie
+                           cookiesWithResponseHeaderFields:[_response 
allHeaderFields]
+                           forURL:[_response URL]]
+                     forURL:[_response URL]
+                     mainDocumentURL:[this->request mainDocumentURL]];
+                }
+
              /* Tell the client that we have a response and how
               * it should be cached.
               */
-- 
1.7.1




reply via email to

[Prev in Thread] Current Thread [Next in Thread]