3 ms·
When the author first stated that the socket was readable but they were getting no bytes, I actually thought this might have to do with BEAST. If I recall corre
by eridius 11y ago
When the author first stated that the socket was readable but they were getting no bytes, I actually thought this might have to do with BEAST. If I recall correctly, at least some implementations of SSL work around BEAST by sending an empty packet prior to the real packet (the empty packet randomizes the IV, which breaks BEAST). And depending on how read is implemented, it might see the empty packet and always return zero bytes (instead of continuing onto the next packet which hopefully was received already). Incidentally, other implementations don't do the empty packet thing, instead they send a packet with just the first byte of the message, followed by a packet with the rest.
Of course, in the end it turned out that the author was querying if the OS buffer had bytes in it, as opposed to querying if there was any application data available. But anyone else doing something similar may want to be aware of this.