X-Git-Url: http://git.maemo.org/git/?p=dh-make-perl;a=blobdiff_plain;f=dev%2Fi386%2Flibnet-ssleay-perl%2Flibnet-ssleay-perl-1.35%2Ft%2Fhandle%2Fexternal%2F50_external.t;fp=dev%2Fi386%2Flibnet-ssleay-perl%2Flibnet-ssleay-perl-1.35%2Ft%2Fhandle%2Fexternal%2F50_external.t;h=d30cafd811092f210dee315c9795fc6c5f348b19;hp=0000000000000000000000000000000000000000;hb=8977e561d8a9eae6959218b0306c9df2056a38a9;hpb=df794b845212301ea0d267c919232538bfef356a diff --git a/dev/i386/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/handle/external/50_external.t b/dev/i386/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/handle/external/50_external.t new file mode 100644 index 0000000..d30cafd --- /dev/null +++ b/dev/i386/libnet-ssleay-perl/libnet-ssleay-perl-1.35/t/handle/external/50_external.t @@ -0,0 +1,71 @@ +#!/usr/bin/perl + +use strict; +use warnings; +use Test::More; +use Symbol qw(gensym); +use Net::SSLeay::Handle; + +my @sites = qw( + www.cdw.com + banking.wellsfargo.com + perldition.org + alioth.debian.org +); +@sites = split(/:/, $ENV{SSLEAY_SITES}) if exists $ENV{SSLEAY_SITES}; +if (@sites) { + plan tests => scalar @sites * 6; +} +else { + plan skip_all => 'No external hosts specified for SSL testing'; +} + + +for my $site (@sites) { + SKIP: { + my $ssl = gensym(); + eval { + tie(*$ssl, 'Net::SSLeay::Handle', $site, 443); + }; + + skip('could not connect', 2) if $@; + pass('connection'); + + print $ssl "GET / HTTP/1.0\r\n\r\n"; + my $resp = do { local $/ = undef; <$ssl> }; + + like( $resp, qr/^HTTP\/1/, 'response' ); + } +} + +{ + my @sock; + for (my $i = 0; $i < scalar @sites; $i++) { + SKIP: { + my $ssl = gensym(); + eval { + tie(*$ssl, 'Net::SSLeay::Handle', $sites[$i], 443); + }; + + skip('could not connect', 2) if $@; + pass('connection'); + + $sock[$i] = $ssl; + ok( $ssl, 'got handle' ); + } + } + + for my $sock (@sock) { + SKIP : { + skip('not connected', 2) unless defined $sock; + pass('connected'); + + print $sock "GET / HTTP/1.0\r\n\r\n"; + + my $resp = do { local $/ = undef; <$sock> }; + like( $resp, qr/^HTTP\/1/, 'response' ); + } + } + + close($_) for @sock; +}