Index: src/SSLSocket.h ================================================================== --- src/SSLSocket.h +++ src/SSLSocket.h @@ -2,15 +2,13 @@ #import @interface SSLSocket: OFTCPSocket { - SSL_CTX *ctx; SSL *ssl; - BOOL handsShaken; } - initWithSocket: (OFTCPSocket*)socket; /* Change the return type */ - (SSLSocket*)accept; @end Index: src/SSLSocket.m ================================================================== --- src/SSLSocket.m +++ src/SSLSocket.m @@ -15,42 +15,31 @@ #import #ifndef INVALID_SOCKET # define INVALID_SOCKET -1 #endif + +static SSL_CTX *ctx; @implementation SSLSocket + (void)load { of_http_request_tls_socket_class = self; } + (void)initialize { - if (self == [SSLSocket class]) - SSL_library_init(); -} - -- init -{ - self = [super init]; - - @try { - if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL) - @throw [OFInitializationFailedException - newWithClass: isa]; - - if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & - SSL_OP_NO_SSLv2) == 0) - @throw [OFInitializationFailedException - newWithClass: isa]; - } @catch (id e) { - [self release]; - @throw e; - } - - return self; + if (self != [SSLSocket class]) + return; + + SSL_library_init(); + + if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL) + @throw [OFInitializationFailedException newWithClass: self]; + + if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2) == 0) + @throw [OFInitializationFailedException newWithClass: self]; } - initWithSocket: (OFTCPSocket*)socket { self = [self init];