From 3013658b200f517b63266a9e2c44ba9a9470479b Mon Sep 17 00:00:00 2001 From: yrutschle Date: Sat, 28 Aug 2021 16:33:20 +0200 Subject: [PATCH] test to drop connection before writing anything (fix #285) --- t | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/t b/t index 7f8185c..4ef5b1d 100755 --- a/t +++ b/t @@ -26,6 +26,7 @@ my $PROBES_NOFRAG = 1; my $PROBES_AGAIN = 1; my $SSL_MIX_SSH = 1; my $SSH_MIX_SSL = 1; +my $DROP_CNX = 1; # Robustness tests. These are mostly to achieve full test # coverage, but do not necessarily result in an actual test @@ -285,6 +286,19 @@ for my $binary (@binaries) { } } +# Test: Drop connection without writing anything + if ($DROP_CNX) { + print "***Test: Connect but don't write anything\n"; + my $cnx_h = new IO::Socket::INET(PeerHost => "localhost:$sslh_port"); + warn "$!\n" unless $cnx_h; + if ($cnx_h) { + close $cnx_h; + my_is(1, "$binary: Connect and write nothing"); + # The goal of the test is to check sslh doesn't + # crash + } + } + if ($PROBES_NOFRAG) { test_probes(no_frag => 1, binary => $binary);