Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -115,11 +115,11 @@ static OFString * constructRequestString(OFHTTPRequest *request) { void *pool = objc_autoreleasePoolPush(); OFHTTPRequestMethod method = request.method; - OFIRI *IRI = request.IRI; + OFIRI *IRI = request.IRI.IRIByAddingPercentEncodingForUnicodeCharacters; OFString *path; OFString *user = IRI.user, *password = IRI.password; OFMutableString *requestString; OFMutableDictionary OF_GENERIC(OFString *, OFString *) *headers; bool hasContentLength, chunked; @@ -665,11 +665,12 @@ [_client->_delegate client: _client didCreateTLSStream: stream request: _request]; stream.delegate = self; - [stream asyncPerformClientHandshakeWithHost: _request.IRI.host]; + [stream asyncPerformClientHandshakeWithHost: _request.IRI + .IRIByAddingPercentEncodingForUnicodeCharacters.host]; } else { sock.delegate = self; [self performSelector: @selector(handleStream:) withObject: sock afterDelay: 0]; @@ -726,11 +727,12 @@ } - (void)closeAndReconnect { @try { - OFIRI *IRI = _request.IRI; + OFIRI *IRI = + _request.IRI.IRIByAddingPercentEncodingForUnicodeCharacters; OFTCPSocket *sock; uint16_t port; OFNumber *IRIPort; [_client close]; Index: src/OFHTTPCookie.m ================================================================== --- src/OFHTTPCookie.m +++ src/OFHTTPCookie.m @@ -65,11 +65,12 @@ forIRI: (OFIRI *)IRI { OFMutableArray OF_GENERIC(OFHTTPCookie *) *ret = [OFMutableArray array]; void *pool = objc_autoreleasePoolPush(); OFString *string = [headerFields objectForKey: @"Set-Cookie"]; - OFString *domain = IRI.host; + OFString *domain = IRI.IRIByAddingPercentEncodingForUnicodeCharacters + .host; const OFUnichar *characters = string.characters; size_t length = string.length, last = 0; enum { statePreName, stateName, Index: src/OFHTTPCookieManager.m ================================================================== --- src/OFHTTPCookieManager.m +++ src/OFHTTPCookieManager.m @@ -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