shlist

share and manage lists between multiple people
Log | Files | Refs

no_ssl_fails.t (769B)


      1 use strict;
      2 use IO::Socket::INET;
      3 use Test;
      4 use SL::Test;
      5 use Time::HiRes qw(usleep);
      6 
      7 BEGIN { plan tests => 1 }
      8 
      9 # Check that a non-SSL connection isn't accepted
     10 
     11 my $s = SL::Test::Server->new();
     12 
     13 my $socket = undef;
     14 while (!defined $socket) {
     15 	$socket = new IO::Socket::INET(
     16 		PeerHost => 'localhost',
     17 		PeerPort => 4729,
     18 	) or usleep(100 * 1000);
     19 }
     20 
     21 my $good_errno = 'Illegal seek';
     22 $socket->syswrite("a\0\0\0" x 787);
     23 
     24 my $ssl_err = '';
     25 if ($^O eq 'linux') {
     26 	$ssl_err = '/SSL accept attempt failed with unknown error error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/';
     27 }
     28 elsif ($^O eq 'openbsd') {
     29 	$ssl_err = '/SSL accept attempt failed error:140760FC:SSL routines:SSL23_GET_CLIENT_HELLO:unknown protocol/';
     30 }
     31 
     32 ok( $s->readline(), $ssl_err );