Developer-Dashboard

 view release on metacpan or  search on metacpan

META.json  view on Meta::CPAN

            "utf8" : "0",
            "warnings" : "0"
         }
      },
      "test" : {
         "requires" : {
            "Archive::Tar" : "0",
            "HTTP::Headers" : "0",
            "HTTP::Request::Common" : "0",
            "HTTP::Response" : "0",
            "IO::Socket::SSL" : "0",
            "Test::More" : "0"
         }
      }
   },
   "provides" : {
      "Developer::Dashboard" : {
         "file" : "lib/Developer/Dashboard.pm",
         "version" : "4.16"
      },
      "Developer::Dashboard::ActionRunner" : {

META.yml  view on Meta::CPAN

---
abstract: 'a local home for development work'
author:
  - 'Developer Dashboard Contributors'
build_requires:
  Archive::Tar: '0'
  HTTP::Headers: '0'
  HTTP::Request::Common: '0'
  HTTP::Response: '0'
  IO::Socket::SSL: '0'
  Test::More: '0'
configure_requires:
  ExtUtils::MakeMaker: '0'
  File::ShareDir::Install: '0'
dynamic_config: 0
generated_by: 'Dist::Zilla version 6.037, CPAN::Meta::Converter version 2.150010'
license: mit
meta-spec:
  url: http://module-build.sourceforge.net/META-spec-v1.4.html
  version: '1.4'

t/17-web-server-ssl.t  view on Meta::CPAN

        warn $msg;
    };
}

use Capture::Tiny qw(capture);
use Errno qw(EADDRINUSE);
use File::Path qw(make_path remove_tree);
use File::Spec;
use File::Temp qw(tempdir tempfile);
use IO::Socket::INET;
use IO::Socket::SSL ();
use HTTP::Request::Common qw(GET);
use LWP::UserAgent;
use Socket qw(AF_UNIX PF_UNSPEC SOCK_STREAM);
use Test::More;
use Time::HiRes qw(sleep);

use lib 'lib';
use lib 't/lib';

use Developer::Dashboard::Web::Server;

t/17-web-server-ssl.t  view on Meta::CPAN

    my $http_response = $http->get("http://127.0.0.1:$port/live-check?mode=http");
    is( $http_response->code, 307, 'live SSL frontend redirects plain HTTP on the public port' );
    is(
        $http_response->header('Location'),
        "https://127.0.0.1:$port/live-check?mode=http",
        'live SSL frontend redirects plain HTTP to the equivalent HTTPS URL on the same public port'
    );

    my $https_socket;
    for ( 1 .. 50 ) {
        $https_socket = IO::Socket::SSL->new(
            PeerHost        => '127.0.0.1',
            PeerPort        => $port,
            SSL_verify_mode => 0,
            Timeout         => 5,
        );
        last if $https_socket;
        sleep 0.1;
    }
    ok( $https_socket, 'live SSL frontend accepts a direct TLS client on the public port' );
    my $https_raw = '';

t/17-web-server-ssl.t  view on Meta::CPAN

          or die "Unable to write HTTPS test request: $!";
        $https_raw = do {
            local $/;
            <$https_socket>;
        };
        close $https_socket;
        like( $https_raw, qr/^HTTP\/1\.1 200 OK\r\n/, 'live SSL frontend still serves HTTPS on the public port' );
        like( $https_raw, qr/\r\n\r\nOK\z/s, 'live SSL frontend preserves the HTTPS app response body' );
    }
    else {
        diag( 'IO::Socket::SSL connect error: ' . ( IO::Socket::SSL::errstr() || 'unknown SSL error' ) );
        fail('live SSL frontend still serves HTTPS on the public port');
        fail('live SSL frontend preserves the HTTPS app response body');
    }

    kill 'TERM', $pid;
    waitpid( $pid, 0 );
}

done_testing();



( run in 0.897 second using v1.01-cache-2.11-cpan-6aa56a78535 )