Construct underlying stream to always consume complete receive buffer. This avoids stale data in TLS buffers and also works around possible buffering issues in legacy PHP versions. The buffer size is limited due to TCP/IP buffers anyway, so this should not affect usage otherwise. This builds on top of reactphp/stream#139 to work around a bug in PHP where reading from a TLS 1.3 stream resource would hang with 100% CPU usage due to the changed TLS 1.3 handshake.
This only simplifies some of unneeded assignments for legacy PHP versions and should not affect usage otherwise. TLS 1.3 is implicitly available despite being omitted in this assignment. The required crypto flag is likely going to be added in PHP 7.2.x in the future via php/php-src#3700 and should thus be covered by the main crypto method constant in the future already. Due to the way how PHP interfaces with OpenSSL, this means that TLS 1.3 is in fact already enabled by default when using a recent OpenSSL version for all client and server connections even for older PHP versions.
jsor approved these changes Jan 3, 2019
clue deleted the tls1.3 branch
January 4, 2019 09:04This was referenced
Jan 4, 2019Closed
Merged
clue
mentioned this pull request
Closed
clue added a commit to clue-labs/socket that referenced this pull request
May 26, 2019This PR improves the test suite to avoid a possible race condition for our TLS tests. It does not change anything about the actual behavior or the expected output, but it helps making the expected output more explicit and no longer subject to a possible race condition. This helps avoiding possible false negatives if TLS 1.3 is supported and PHP reports the EOF indicator before consuming all application data. This builds on top of reactphp#185 and reactphp#186
This was referenced
May 26, 2019Merged
Merged
clue
mentioned this pull request
Merged