diff options
author | Tharanga Gamaethige <tgamaethige@netflix.com> | 2018-11-30 17:44:33 -0800 |
---|---|---|
committer | dormando <dormando@rydia.net> | 2019-04-15 21:36:18 -0700 |
commit | ee1cfe3bf9384d1a93545fc942e25bed6437d910 (patch) | |
tree | 2e880ddd3d263b85f2cf6de73b8eb15d14d02e37 /t/ssl_ports.t | |
parent | d2dcfff7edd28baf3587ab103d6fbac322335a68 (diff) | |
download | memcached-ee1cfe3bf9384d1a93545fc942e25bed6437d910.tar.gz |
Basic implementation of TLS for memcached.1.5.13
Most of the work done by Tharanga. Some commits squashed in by
dormando. Also reviewed by dormando.
Tested, working, but experimental implementation of TLS for memcached.
Enable with ./configure --enable-tls
Requires OpenSSL 1.1.0 or better.
See `memcached -h` output for usage.
Diffstat (limited to 't/ssl_ports.t')
-rw-r--r-- | t/ssl_ports.t | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/t/ssl_ports.t b/t/ssl_ports.t new file mode 100644 index 0000000..d717f63 --- /dev/null +++ b/t/ssl_ports.t @@ -0,0 +1,31 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; +use FindBin qw($Bin); +use lib "$Bin/lib"; +use MemcachedTest; + + +if (!enabled_tls_testing()) { + plan skip_all => 'SSL testing is not enabled'; + exit 0; +} + +my $tcp_port = free_port(); +my $ssl_port = free_port(); + +my $server = new_memcached("-l notls:127.0.0.1:$tcp_port,127.0.0.1:$ssl_port", $ssl_port); +my $sock = $server->sock; + +# Make sure we can talk over SSL +print $sock "set foo:123 0 0 16\r\nfoo set over SSL\r\n"; +is(scalar <$sock>, "STORED\r\n", "stored foo"); + + +#.. and TCP +my $tcp_sock = IO::Socket::INET->new(PeerAddr => "127.0.0.1:$tcp_port"); +mem_get_is($tcp_sock, "foo:123", "foo set over SSL"); + +done_testing() |