# HG changeset patch # User Sergey Kandaurov # Date 1477056750 -10800 # Node ID 4606a2ec3d7c8be4ba6ccce2571cb5bb57f92767 # Parent 23418577df58480b3811093ade814a2c76e640cc Tests: ssl.t cleanup, no functional changes. diff --git a/ssl.t b/ssl.t --- a/ssl.t +++ b/ssl.t @@ -150,30 +150,20 @@ my $ctx = new IO::Socket::SSL::SSL_Conte ############################################################################### -like(http_get('/reuse', socket => get_ssl_socket($ctx, port(8085))), - qr/^body \.$/m, 'shared initial session'); -like(http_get('/reuse', socket => get_ssl_socket($ctx, port(8085))), - qr/^body r$/m, 'shared session reused'); +like(get('/reuse', 8085), qr/^body \.$/m, 'shared initial session'); +like(get('/reuse', 8085), qr/^body r$/m, 'shared session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8081))), qr/^body \.$/m, - 'builtin initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8081))), qr/^body r$/m, - 'builtin session reused'); +like(get('/', 8081), qr/^body \.$/m, 'builtin initial session'); +like(get('/', 8081), qr/^body r$/m, 'builtin session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8082))), qr/^body \.$/m, - 'builtin size initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8082))), qr/^body r$/m, - 'builtin size session reused'); +like(get('/', 8082), qr/^body \.$/m, 'builtin size initial session'); +like(get('/', 8082), qr/^body r$/m, 'builtin size session reused'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8083))), qr/^body \.$/m, - 'reused none initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8083))), qr/^body \.$/m, - 'session not reused 1'); +like(get('/', 8083), qr/^body \.$/m, 'reused none initial session'); +like(get('/', 8083), qr/^body \.$/m, 'session not reused 1'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8084))), qr/^body \.$/m, - 'reused off initial session'); -like(http_get('/', socket => get_ssl_socket($ctx, port(8084))), qr/^body \.$/m, - 'session not reused 2'); +like(get('/', 8084), qr/^body \.$/m, 'reused off initial session'); +like(get('/', 8084), qr/^body \.$/m, 'session not reused 2'); # ssl certificate inheritance @@ -191,28 +181,24 @@ like($s->dump_peer_certificate(), qr/CN= select undef, undef, undef, 2.1; -like(http_get('/', socket => get_ssl_socket($ctx, port(8081))), qr/^body \.$/m, - 'session timeout'); +like(get('/', 8081), qr/^body \.$/m, 'session timeout'); # embedded variables -my ($sid) = http_get('/id', - socket => get_ssl_socket($ctx, port(8085))) =~ /^body (\w+)$/m; -is(length $sid, 64, 'session id'); - +like(get('/id', 8085), qr/^body \w{64}$/m, 'session id'); unlike(http_get('/id'), qr/body \w/, 'session id no ssl'); - -like(http_get('/cipher', socket => get_ssl_socket($ctx, port(8085))), - qr/^body [\w-]+$/m, 'cipher'); - -like(http_get('/client_verify', socket => get_ssl_socket($ctx, port(8085))), - qr/^body NONE$/m, 'client verify'); - -like(http_get('/protocol', socket => get_ssl_socket($ctx, port(8085))), - qr/^body (TLS|SSL)v(\d|\.)+$/m, 'protocol'); +like(get('/cipher', 8085), qr/^body [\w-]+$/m, 'cipher'); +like(get('/client_verify', 8085), qr/^body NONE$/m, 'client verify'); +like(get('/protocol', 8085), qr/^body (TLS|SSL)v(\d|\.)+$/m, 'protocol'); ############################################################################### +sub get { + my ($uri, $port) = @_; + my $s = get_ssl_socket($ctx, port($port)) or return; + http_get($uri, socket => $s); +} + sub get_ssl_socket { my ($ctx, $port) = @_; my $s;