Differences From Artifact [c722ef4615]:
- File src/tls/OFSecureTransportTLSStream.m — part of check-in [8939cbdb52] at 2023-01-06 09:04:02 on branch trunk — Update copyright (user: js, size: 6884) [annotate] [blame] [check-ins using] [more...]
To Artifact [4775886a79]:
- File
src/tls/OFSecureTransportTLSStream.m
— part of check-in
[1a3613d573]
at
2023-09-10 12:11:53
on branch trunk
— More consistency between TLS implementations
While GnuTLS and SecureTransport haven't shown in practice to need this,
this makes it more robust for future changes in those. In theory, both
could return less data on a read than they have buffered, meaning the
delimiter is not found but in the buffered data, which would then make
them have the same issue OpenSSL had with hanging connections (though
there the problem was that the BIO was not processed and never would
without the same change as in this commit). (user: js, size: 7445) [annotate] [blame] [check-ins using] [more...]
︙ | |||
14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 | + | */ #include "config.h" #include <errno.h> #import "OFSecureTransportTLSStream.h" #import "OFStream+Private.h" #import "OFAlreadyOpenException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" |
︙ | |||
174 175 176 177 178 179 180 181 182 183 184 185 186 187 | 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | + + + + + + + + + + + + + + + + + + + | if (SSLGetBufferedReadSize(_context, &bufferSize) == noErr && bufferSize > 0) return true; return super.hasDataInReadBuffer; } - (bool)of_isWaitingForDelimiter { size_t bufferSize; /* FIXME: There should be a non-private API for this. */ /* * If we still have pending data in the context, we haven't processed * it yet to see if our delimiter is in there. So return false here, as * that will signal the stream as ready for reading, which in turn will * cause a read and checking for the delimiter. */ if (SSLGetBufferedReadSize(_context, &bufferSize) == noErr && bufferSize > 0) return false; return super.of_waitingForDelimiter; } - (void)asyncPerformClientHandshakeWithHost: (OFString *)host runLoopMode: (OFRunLoopMode)runLoopMode { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; |
︙ |