Adjust to ObjFW changes

FossilOrigin-Name: 22d082c6ea1b730d24ccdc009fe56d654a5f11570c0b15758105ee3c5efd9d2c
This commit is contained in:
Jonathan Schleifer 2021-11-07 20:04:58 +00:00
parent 5f488dbdd5
commit f1c1bf756b

View file

@ -284,14 +284,8 @@ lockingCallback(int mode, int n, const char *file, int line)
{ {
ssize_t ret; ssize_t ret;
/*
* There is no SSL session yet. However, it might be necessary to read
* from and write to the socket before negotiating an SSL session: For
* example, the socket might be connected to a SOCKS5 proxy and needs
* to establish a SOCKS5 connection before negotiating an SSL session.
*/
if (_SSL == NULL) if (_SSL == NULL)
return [self lowlevelTCPReadIntoBuffer: buffer length: length]; @throw [OFNotOpenException exceptionWithObject: self];
if (length > INT_MAX) if (length > INT_MAX)
@throw [OFOutOfRangeException exception]; @throw [OFOutOfRangeException exception];
@ -323,18 +317,8 @@ lockingCallback(int mode, int n, const char *file, int line)
{ {
int bytesWritten; int bytesWritten;
/*
* There is no SSL session yet. However, it might be necessary to read
* from and write to the socket before negotiating an SSL session: For
* example, the socket might be connected to a SOCKS5 proxy and needs
* to establish a SOCKS5 connection before negotiating an SSL session.
*
* TODO: Think of a way to make this safer, so that it's impossible to
* forget to establish an SSL session and then send unencrypted data by
* accident.
*/
if (_SSL == NULL) if (_SSL == NULL)
return [self lowlevelTCPWriteBuffer: buffer length: length]; @throw [OFNotOpenException exceptionWithObject: self];
if (_socket == INVALID_SOCKET) if (_socket == INVALID_SOCKET)
@throw [OFNotOpenException exceptionWithObject: self]; @throw [OFNotOpenException exceptionWithObject: self];
@ -351,12 +335,12 @@ lockingCallback(int mode, int n, const char *file, int line)
return bytesWritten; return bytesWritten;
} }
- (bool)lowlevelIsAtEndOfStream - (bool)hasDataInReadBuffer
{ {
if (_SSL != NULL && SSL_pending(_SSL) > 0) if (_SSL != NULL && SSL_pending(_SSL) > 0)
return false; return true;
return [self lowlevelTCPIsAtEndOfStream]; return [super hasDataInReadBuffer];
} }
- (OFData *)channelBindingDataWithType: (OFString *)type - (OFData *)channelBindingDataWithType: (OFString *)type