# HG changeset patch # User Sergey Kandaurov # Date 1606171566 0 # Node ID 436d0ffc2ea3f5e4171eb3db6f880f9ef7803055 # Parent cea0591b13dd570adf883452046054c158100c99 Tests: correctly shutdown ssl for reproducible session reuse tests. Previously, session reuse tests in stream_ssl_certificate.t were prone to testing errors, since the client doesn't write any application data before closing a connection, which is done so to pass tests on win32. In this case, the server may happened to get an unexpected eof meaning that it will abandon that session. This is specific to stream testing pattern, changes to ssl_certificate.t are applied too for consistency. This is also specific to SSL_R_UNEXPECTED_EOF_WHILE_READING, which is implemented in OpenSSL 3.0.0. diff --git a/ssl_certificate.t b/ssl_certificate.t --- a/ssl_certificate.t +++ b/ssl_certificate.t @@ -200,6 +200,7 @@ sub get { my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; Net::SSLeay::write($ssl, 'GET / HTTP/1.0' . CRLF . CRLF); my $r = Net::SSLeay::read($ssl); + Net::SSLeay::shutdown($ssl); $s->close(); return $r unless wantarray(); return ($s, $ssl); diff --git a/stream_ssl_certificate.t b/stream_ssl_certificate.t --- a/stream_ssl_certificate.t +++ b/stream_ssl_certificate.t @@ -182,6 +182,7 @@ sub get { my ($host, $port, $ctx) = @_; my ($s, $ssl) = get_ssl_socket($host, $port, $ctx) or return; my $r = Net::SSLeay::read($ssl); + Net::SSLeay::shutdown($ssl); $s->close(); return $r unless wantarray(); return ($s, $ssl);