Adjust to recent ObjFW changes.
This commit is contained in:
parent
0972f8ee36
commit
250d2452dd
1 changed files with 37 additions and 35 deletions
|
@ -59,10 +59,12 @@ static SSL_CTX *ctx;
|
|||
SSL_library_init();
|
||||
|
||||
if ((ctx = SSL_CTX_new(SSLv23_method())) == NULL)
|
||||
@throw [OFInitializationFailedException newWithClass: self];
|
||||
@throw [OFInitializationFailedException
|
||||
exceptionWithClass: self];
|
||||
|
||||
if ((SSL_CTX_set_options(ctx, SSL_OP_NO_SSLv2) & SSL_OP_NO_SSLv2) == 0)
|
||||
@throw [OFInitializationFailedException newWithClass: self];
|
||||
@throw [OFInitializationFailedException
|
||||
exceptionWithClass: self];
|
||||
}
|
||||
|
||||
- initWithSocket: (OFTCPSocket*)socket
|
||||
|
@ -76,7 +78,7 @@ static SSL_CTX *ctx;
|
|||
close(sock);
|
||||
sock = INVALID_SOCKET;
|
||||
@throw [OFInitializationFailedException
|
||||
newWithClass: isa];
|
||||
exceptionWithClass: isa];
|
||||
}
|
||||
|
||||
SSL_set_connect_state(ssl);
|
||||
|
@ -91,7 +93,7 @@ static SSL_CTX *ctx;
|
|||
close(sock);
|
||||
sock = INVALID_SOCKET;
|
||||
@throw [OFInitializationFailedException
|
||||
newWithClass: isa];
|
||||
exceptionWithClass: isa];
|
||||
}
|
||||
} @catch (id e) {
|
||||
[self release];
|
||||
|
@ -122,7 +124,7 @@ static SSL_CTX *ctx;
|
|||
|
||||
if ((ssl = SSL_new(ctx)) == NULL || !SSL_set_fd(ssl, sock)) {
|
||||
[super close];
|
||||
@throw [OFConnectionFailedException newWithClass: isa
|
||||
@throw [OFConnectionFailedException exceptionWithClass: isa
|
||||
socket: self
|
||||
host: host
|
||||
port: port];
|
||||
|
@ -137,7 +139,7 @@ static SSL_CTX *ctx;
|
|||
cStringWithEncoding: OF_STRING_ENCODING_NATIVE],
|
||||
SSL_FILETYPE_PEM)) || SSL_connect(ssl) != 1) {
|
||||
[super close];
|
||||
@throw [OFConnectionFailedException newWithClass: isa
|
||||
@throw [OFConnectionFailedException exceptionWithClass: isa
|
||||
socket: self
|
||||
host: host
|
||||
port: port];
|
||||
|
@ -155,7 +157,7 @@ static SSL_CTX *ctx;
|
|||
[newSocket close];
|
||||
newSocket->isa = isa;
|
||||
|
||||
@throw [OFAcceptFailedException newWithClass: isa
|
||||
@throw [OFAcceptFailedException exceptionWithClass: isa
|
||||
socket: self];
|
||||
}
|
||||
|
||||
|
@ -171,7 +173,7 @@ static SSL_CTX *ctx;
|
|||
[newSocket close];
|
||||
newSocket->isa = isa;
|
||||
|
||||
@throw [OFAcceptFailedException newWithClass: isa
|
||||
@throw [OFAcceptFailedException exceptionWithClass: isa
|
||||
socket: self];
|
||||
}
|
||||
|
||||
|
@ -191,16 +193,16 @@ static SSL_CTX *ctx;
|
|||
ssize_t ret;
|
||||
|
||||
if (length > INT_MAX)
|
||||
@throw [OFOutOfRangeException newWithClass: isa];
|
||||
@throw [OFOutOfRangeException exceptionWithClass: isa];
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
@throw [OFNotConnectedException newWithClass: isa
|
||||
@throw [OFNotConnectedException exceptionWithClass: isa
|
||||
socket: self];
|
||||
|
||||
if (atEndOfStream) {
|
||||
OFReadFailedException *e;
|
||||
|
||||
e = [OFReadFailedException newWithClass: isa
|
||||
e = [OFReadFailedException exceptionWithClass: isa
|
||||
stream: self
|
||||
requestedLength: length];
|
||||
#ifndef _WIN32
|
||||
|
@ -213,7 +215,7 @@ static SSL_CTX *ctx;
|
|||
}
|
||||
|
||||
if ((ret = SSL_read(ssl, buffer, (int)length)) < 0)
|
||||
@throw [OFReadFailedException newWithClass: isa
|
||||
@throw [OFReadFailedException exceptionWithClass: isa
|
||||
stream: self
|
||||
requestedLength: length];
|
||||
|
||||
|
@ -227,16 +229,16 @@ static SSL_CTX *ctx;
|
|||
fromBuffer: (const void*)buffer
|
||||
{
|
||||
if (length > INT_MAX)
|
||||
@throw [OFOutOfRangeException newWithClass: isa];
|
||||
@throw [OFOutOfRangeException exceptionWithClass: isa];
|
||||
|
||||
if (sock == INVALID_SOCKET)
|
||||
@throw [OFNotConnectedException newWithClass: isa
|
||||
@throw [OFNotConnectedException exceptionWithClass: isa
|
||||
socket: self];
|
||||
|
||||
if (atEndOfStream) {
|
||||
OFWriteFailedException *e;
|
||||
|
||||
e = [OFWriteFailedException newWithClass: isa
|
||||
e = [OFWriteFailedException exceptionWithClass: isa
|
||||
stream: self
|
||||
requestedLength: length];
|
||||
|
||||
|
@ -250,7 +252,7 @@ static SSL_CTX *ctx;
|
|||
}
|
||||
|
||||
if (SSL_write(ssl, buffer, (int)length) < length)
|
||||
@throw [OFWriteFailedException newWithClass: isa
|
||||
@throw [OFWriteFailedException exceptionWithClass: isa
|
||||
stream: self
|
||||
requestedLength: length];
|
||||
}
|
||||
|
@ -287,7 +289,7 @@ static SSL_CTX *ctx;
|
|||
OFDataArray *data;
|
||||
|
||||
if (![type isEqual: @"tls-unique"])
|
||||
@throw [OFInvalidArgumentException newWithClass: isa
|
||||
@throw [OFInvalidArgumentException exceptionWithClass: isa
|
||||
selector: _cmd];
|
||||
|
||||
if (SSL_session_reused(ssl) ^ !listening) {
|
||||
|
|
Reference in a new issue