@@ -17,11 +17,11 @@ #import "OFHTTPCookieManager.h" #import "OFArray.h" #import "OFDate.h" #import "OFHTTPCookie.h" -#import "OFURI.h" +#import "OFIRI.h" @implementation OFHTTPCookieManager + (instancetype)manager { return [[[self alloc] init] autorelease]; @@ -51,33 +51,33 @@ - (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies { return [[_cookies copy] autorelease]; } -- (void)addCookie: (OFHTTPCookie *)cookie forURI: (OFURI *)URI +- (void)addCookie: (OFHTTPCookie *)cookie forIRI: (OFIRI *)IRI { void *pool = objc_autoreleasePoolPush(); - OFString *cookieDomain, *URIHost; + OFString *cookieDomain, *IRIHost; size_t i; if (![cookie.path hasPrefix: @"/"]) cookie.path = @"/"; if (cookie.secure && - [URI.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) { + [IRI.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) { objc_autoreleasePoolPop(pool); return; } cookieDomain = cookie.domain.lowercaseString; cookie.domain = cookieDomain; - URIHost = URI.host.lowercaseString; - if (![cookieDomain isEqual: URIHost]) { - URIHost = [@"." stringByAppendingString: URIHost]; + IRIHost = IRI.host.lowercaseString; + if (![cookieDomain isEqual: IRIHost]) { + IRIHost = [@"." stringByAppendingString: IRIHost]; - if (![cookieDomain hasSuffix: URIHost]) { + if (![cookieDomain hasSuffix: IRIHost]) { objc_autoreleasePoolPop(pool); return; } } @@ -98,66 +98,66 @@ objc_autoreleasePoolPop(pool); } - (void)addCookies: (OFArray OF_GENERIC(OFHTTPCookie *) *)cookies - forURI: (OFURI *)URI + forIRI: (OFIRI *)IRI { for (OFHTTPCookie *cookie in cookies) - [self addCookie: cookie forURI: URI]; + [self addCookie: cookie forIRI: IRI]; } -- (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesForURI: (OFURI *)URI +- (OFArray OF_GENERIC(OFHTTPCookie *) *)cookiesForIRI: (OFIRI *)IRI { OFMutableArray *ret = [OFMutableArray array]; for (OFHTTPCookie *cookie in _cookies) { void *pool; OFDate *expires; - OFString *cookieDomain, *URIHost, *cookiePath, *URIPath; + OFString *cookieDomain, *IRIHost, *cookiePath, *IRIPath; bool match; expires = cookie.expires; if (expires != nil && expires.timeIntervalSinceNow <= 0) continue; - if (cookie.secure && [URI.scheme caseInsensitiveCompare: + if (cookie.secure && [IRI.scheme caseInsensitiveCompare: @"https"] != OFOrderedSame) continue; pool = objc_autoreleasePoolPush(); cookieDomain = cookie.domain.lowercaseString; - URIHost = URI.host.lowercaseString; + IRIHost = IRI.host.lowercaseString; if ([cookieDomain hasPrefix: @"."]) { - if ([URIHost hasSuffix: cookieDomain]) + if ([IRIHost hasSuffix: cookieDomain]) match = true; else { cookieDomain = [cookieDomain substringFromIndex: 1]; - match = [cookieDomain isEqual: URIHost]; + match = [cookieDomain isEqual: IRIHost]; } } else - match = [cookieDomain isEqual: URIHost]; + match = [cookieDomain isEqual: IRIHost]; if (!match) { objc_autoreleasePoolPop(pool); continue; } cookiePath = cookie.path; - URIPath = URI.path; + IRIPath = IRI.path; if (![cookiePath isEqual: @"/"]) { - if ([cookiePath isEqual: URIPath]) + if ([cookiePath isEqual: IRIPath]) match = true; else { if (![cookiePath hasSuffix: @"/"]) cookiePath = [cookiePath stringByAppendingString: @"/"]; - match = [URIPath hasPrefix: cookiePath]; + match = [IRIPath hasPrefix: cookiePath]; } if (!match) { objc_autoreleasePoolPop(pool); continue;