Differences From Artifact [b0bb2b39ec]:
- File src/tls/OFGnuTLSTLSStream.m — part of check-in [8939cbdb52] at 2023-01-06 09:04:02 on branch trunk — Update copyright (user: js, size: 9125) [annotate] [blame] [check-ins using] [more...]
To Artifact [ba84ecba17]:
- File
src/tls/OFGnuTLSTLSStream.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: 9629) [annotate] [blame] [check-ins using] [more...]
︙ | ︙ | |||
15 16 17 18 19 20 21 22 23 24 25 26 27 28 | #include "config.h" #include <errno.h> #import "OFGnuTLSTLSStream.h" #import "OFData.h" #import "OFAlreadyOpenException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" | > | 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | #include "config.h" #include <errno.h> #import "OFGnuTLSTLSStream.h" #import "OFData.h" #import "OFStream+Private.h" #import "OFAlreadyOpenException.h" #import "OFInitializationFailedException.h" #import "OFNotOpenException.h" #import "OFReadFailedException.h" #import "OFTLSHandshakeFailedException.h" #import "OFWriteFailedException.h" |
︙ | ︙ | |||
188 189 190 191 192 193 194 195 196 197 198 199 200 201 | - (bool)hasDataInReadBuffer { if (gnutls_record_check_pending(_session) > 0) return true; return super.hasDataInReadBuffer; } - (void)asyncPerformClientHandshakeWithHost: (OFString *)host runLoopMode: (OFRunLoopMode)runLoopMode { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; | > > > > > > > > > > > > > > > > | 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 | - (bool)hasDataInReadBuffer { if (gnutls_record_check_pending(_session) > 0) return true; return super.hasDataInReadBuffer; } - (bool)of_isWaitingForDelimiter { /* FIXME: There should be a non-private API for this. */ /* * If we still have pending data in the session, 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 (gnutls_record_check_pending(_session) > 0) return false; return super.of_waitingForDelimiter; } - (void)asyncPerformClientHandshakeWithHost: (OFString *)host runLoopMode: (OFRunLoopMode)runLoopMode { static const OFTLSStreamErrorCode initFailedErrorCode = OFTLSStreamErrorCodeInitializationFailed; id exception = nil; |
︙ | ︙ |