@@ -59,10 +59,11 @@ - initWithClient: (OFHTTPClient *)client request: (OFHTTPRequest *)request redirects: (unsigned int)redirects context: (id)context; - (void)start; +- (void)closeAndReconnect; @end @interface OFHTTPClientResponse: OFHTTPResponse { OFTCPSocket *_socket; @@ -235,35 +236,10 @@ [_serverHeaders release]; [super dealloc]; } -- (void)closeAndReconnect -{ - OFURL *URL = [_request URL]; - OFTCPSocket *socket; - - [_client close]; - - if ([[URL scheme] isEqual: @"https"]) { - if (of_tls_socket_class == Nil) - @throw [OFUnsupportedProtocolException - exceptionWithURL: URL]; - - socket = [[[of_tls_socket_class alloc] init] - autorelease]; - } else - socket = [OFTCPSocket socket]; - - [socket asyncConnectToHost: [URL host] - port: [URL port] - target: self - selector: @selector(socketDidConnect:context: - exception:) - context: nil]; -} - - (void)createResponseWithSocket: (OFTCPSocket *)socket { OFURL *URL = [_request URL]; OFHTTPClientResponse *response; OFString *connectionHeader; @@ -714,10 +690,35 @@ afterDelay: 0]; } } else [self closeAndReconnect]; } + +- (void)closeAndReconnect +{ + OFURL *URL = [_request URL]; + OFTCPSocket *socket; + + [_client close]; + + if ([[URL scheme] isEqual: @"https"]) { + if (of_tls_socket_class == Nil) + @throw [OFUnsupportedProtocolException + exceptionWithURL: URL]; + + socket = [[[of_tls_socket_class alloc] init] + autorelease]; + } else + socket = [OFTCPSocket socket]; + + [socket asyncConnectToHost: [URL host] + port: [URL port] + target: self + selector: @selector(socketDidConnect:context: + exception:) + context: nil]; +} @end @implementation OFHTTPClientResponse @synthesize of_keepAlive = _keepAlive;