Index: src/OFHTTPClient.m ================================================================== --- src/OFHTTPClient.m +++ src/OFHTTPClient.m @@ -540,11 +540,11 @@ if ([exception isKindOfClass: [OFWriteFailedException class]] && ([exception errNo] == ECONNRESET || [exception errNo] == EPIPE)) { /* In case a keep-alive connection timed out */ [self closeAndReconnect]; - return false; + return 0; } [_client->_delegate client: _client didEncounterException: exception forRequest: _request @@ -605,10 +605,18 @@ - (void)socketDidConnect: (OFTCPSocket *)socket context: (id)context exception: (id)exception { + if (exception != nil) { + [_client->_delegate client: _client + didEncounterException: exception + forRequest: _request + context: _context]; + return; + } + if ([_client->_delegate respondsToSelector: @selector(client:didCreateSocket:forRequest:context:)]) [_client->_delegate client: _client didCreateSocket: socket forRequest: _request