[nginx-tests] Tests: workaround for IO::Socket::SSL sysread() is...

Maxim Dounin mdounin at mdounin.ru
Fri Jul 11 09:51:44 UTC 2025


details:   http://freenginx.org/hg/nginx-tests/rev/0b27b42aef05
branches:  
changeset: 2011:0b27b42aef05
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Fri Jul 11 12:49:19 2025 +0300
description:
Tests: workaround for IO::Socket::SSL sysread() issue.

IO::Socket::SSL 2.091 to 2.094 fails to clear buffer in sysread() on EOF
(https://github.com/noxxi/p5-io-socket-ssl/issues/171), the issue is fixed
in IO::Socket::SSL 2.095.

As a as a workaround for the affected versions, we set the buffer explicitly
to an empty string if sysread() returns 0.

diffstat:

 lib/Test/Nginx/Stream.pm |  7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diffs (17 lines):

diff --git a/lib/Test/Nginx/Stream.pm b/lib/Test/Nginx/Stream.pm
--- a/lib/Test/Nginx/Stream.pm
+++ b/lib/Test/Nginx/Stream.pm
@@ -114,6 +114,13 @@ sub read {
 	while (IO::Select->new($s)->can_read($extra{read_timeout} || 8)) {
 		my $n = $s->sysread($buf, 1024);
 		next if !defined $n && $!{EWOULDBLOCK};
+
+		# IO::Socket::SSL 2.091 to 2.094 fails to clear buffer on EOF
+		# (https://github.com/noxxi/p5-io-socket-ssl/issues/171);
+		# as a workaround, we set it explicitly to an empty string
+
+		$buf = '' if defined $n && $n == 0;
+
 		last;
 	}
 


More information about the nginx-devel mailing list