@@ -57,10 +57,12 @@ { void *pool = objc_autoreleasePoolPush(); OFString *cookieDomain, *IRIHost; size_t i; + IRI = IRI.IRIByAddingPercentEncodingForUnicodeCharacters; + if (![cookie.path hasPrefix: @"/"]) cookie.path = @"/"; if (cookie.secure && [IRI.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) { @@ -107,13 +109,16 @@ } - (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesForIRI: (OFIRI *)IRI { OFMutableArray *ret = [OFMutableArray array]; + void *pool = objc_autoreleasePoolPush(); + + IRI = IRI.IRIByAddingPercentEncodingForUnicodeCharacters; for (OFHTTPCookie *cookie in _cookies) { - void *pool; + void *pool2; OFDate *expires; OFString *cookieDomain, *IRIHost, *cookiePath, *IRIPath; bool match; expires = cookie.expires; @@ -122,11 +127,11 @@ if (cookie.secure && [IRI.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) continue; - pool = objc_autoreleasePoolPush(); + pool2 = objc_autoreleasePoolPush(); cookieDomain = cookie.domain.lowercaseString; IRIHost = IRI.host.lowercaseString; if ([cookieDomain hasPrefix: @"."]) { if ([IRIHost hasSuffix: cookieDomain]) @@ -139,11 +144,11 @@ } } else match = [cookieDomain isEqual: IRIHost]; if (!match) { - objc_autoreleasePoolPop(pool); + objc_autoreleasePoolPop(pool2); continue; } cookiePath = cookie.path; IRIPath = IRI.path; @@ -157,19 +162,21 @@ match = [IRIPath hasPrefix: cookiePath]; } if (!match) { - objc_autoreleasePoolPop(pool); + objc_autoreleasePoolPop(pool2); continue; } } [ret addObject: cookie]; } [ret makeImmutable]; + + objc_autoreleasePoolPop(pool); return ret; } - (void)purgeExpiredCookies