Showing
2 changed files
with
11 additions
and
4 deletions
@@ -830,18 +830,25 @@ static NSError *ASIUnableToCreateRequestError; | @@ -830,18 +830,25 @@ static NSError *ASIUnableToCreateRequestError; | ||
830 | 830 | ||
831 | // Handle cookies | 831 | // Handle cookies |
832 | NSArray *cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:responseHeaders forURL:url]; | 832 | NSArray *cookies = [NSHTTPCookie cookiesWithResponseHeaderFields:responseHeaders forURL:url]; |
833 | - [self setResponseCookies:cookies]; | 833 | + NSMutableArray *newCookies = [[[NSMutableArray alloc] init] autorelease]; |
834 | + for (NSHTTPCookie *cookie in cookies) { | ||
835 | + NSMutableDictionary *properties = [[[NSMutableDictionary alloc] initWithDictionary:[cookie properties]] autorelease]; | ||
836 | + [properties setValue:[cookie decodedValue] forKey:NSHTTPCookieValue]; | ||
837 | + [newCookies addObject:[NSHTTPCookie cookieWithProperties:properties]]; | ||
838 | + } | ||
839 | + | ||
840 | + [self setResponseCookies:newCookies]; | ||
834 | 841 | ||
835 | if (useCookiePersistance) { | 842 | if (useCookiePersistance) { |
836 | 843 | ||
837 | // Store cookies in global persistent store | 844 | // Store cookies in global persistent store |
838 | - [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:cookies forURL:url mainDocumentURL:nil]; | 845 | + [[NSHTTPCookieStorage sharedHTTPCookieStorage] setCookies:newCookies forURL:url mainDocumentURL:nil]; |
839 | 846 | ||
840 | // We also keep any cookies in the sessionCookies array, so that we have a reference to them if we need to remove them later | 847 | // We also keep any cookies in the sessionCookies array, so that we have a reference to them if we need to remove them later |
841 | if (!sessionCookies) { | 848 | if (!sessionCookies) { |
842 | [ASIHTTPRequest setSessionCookies:[[[NSMutableArray alloc] init] autorelease]]; | 849 | [ASIHTTPRequest setSessionCookies:[[[NSMutableArray alloc] init] autorelease]]; |
843 | NSHTTPCookie *cookie; | 850 | NSHTTPCookie *cookie; |
844 | - for (cookie in cookies) { | 851 | + for (cookie in newCookies) { |
845 | [[ASIHTTPRequest sessionCookies] addObject:cookie]; | 852 | [[ASIHTTPRequest sessionCookies] addObject:cookie]; |
846 | } | 853 | } |
847 | } | 854 | } |
@@ -302,7 +302,6 @@ | @@ -302,7 +302,6 @@ | ||
302 | success = [html isEqualToString:@"I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'"]; | 302 | success = [html isEqualToString:@"I have 'Test Value' as the value of 'ASIHTTPRequestTestCookie'"]; |
303 | GHAssertTrue(success,@"Custom cookie not presented to the server with cookie persistance OFF"); | 303 | GHAssertTrue(success,@"Custom cookie not presented to the server with cookie persistance OFF"); |
304 | 304 | ||
305 | - | ||
306 | 305 | ||
307 | // Test removing all cookies works | 306 | // Test removing all cookies works |
308 | [ASIHTTPRequest clearSession]; | 307 | [ASIHTTPRequest clearSession]; |
@@ -534,4 +533,5 @@ | @@ -534,4 +533,5 @@ | ||
534 | GHAssertTrue(success,@"Failed to correctly display increment progress for a partial download"); | 533 | GHAssertTrue(success,@"Failed to correctly display increment progress for a partial download"); |
535 | } | 534 | } |
536 | 535 | ||
536 | + | ||
537 | @end | 537 | @end |
-
Please register or login to post a comment