"Fossies" - the Fresh Open Source Software Archive

Member "memcached-1.6.15/t/ssl_ports.t" (21 Feb 2022, 689 Bytes) of package /linux/www/memcached-1.6.15.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Perl source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file.

    1 #!/usr/bin/perl
    2 
    3 use strict;
    4 use warnings;
    5 use Test::More;
    6 use FindBin qw($Bin);
    7 use lib "$Bin/lib";
    8 use MemcachedTest;
    9 
   10 
   11 if (!enabled_tls_testing()) {
   12     plan skip_all => 'SSL testing is not enabled';
   13     exit 0;
   14 }
   15 
   16 my $tcp_port = free_port();
   17 my $ssl_port = free_port();
   18 
   19 my $server = new_memcached("-l notls:127.0.0.1:$tcp_port,127.0.0.1:$ssl_port", $ssl_port);
   20 my $sock = $server->sock;
   21 
   22 # Make sure we can talk over SSL
   23 print $sock "set foo:123 0 0 16\r\nfoo set over SSL\r\n";
   24 is(scalar <$sock>, "STORED\r\n", "stored foo");
   25 
   26 
   27 #.. and TCP
   28 my $tcp_sock = IO::Socket::INET->new(PeerAddr => "127.0.0.1:$tcp_port");
   29 mem_get_is($tcp_sock, "foo:123", "foo set over SSL");
   30 
   31 done_testing()