Skip to content

Commit

Permalink
better SNI test case
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed May 18, 2012
1 parent 9ec98cf commit bf39a3a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Changes
@@ -1,5 +1,5 @@

2.96 2012-05-17
2.96 2012-05-18
- Added merge method to Mojo::Path.
- Improved documentation.
- Improved tests.
Expand Down
17 changes: 11 additions & 6 deletions t/mojo/user_agent_online.t
Expand Up @@ -12,7 +12,7 @@ plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)'
unless $ENV{TEST_ONLINE};
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 105;
plan tests => 106;

# "So then I said to the cop, "No, you're driving under the influence...
# of being a jerk"."
Expand Down Expand Up @@ -153,11 +153,16 @@ my $res = f('search.cpan.org/search' => {query => 'mojolicious'});
like $res->body, qr/Mojolicious/, 'right content';
is $res->code, 200, 'right status';

# Simple HTTPS request
$tx = $ua->get('https://www.metacpan.org');
is $tx->req->method, 'GET', 'right method';
is $tx->req->url, 'https://www.metacpan.org', 'right url';
is $tx->res->code, 200, 'right status';
# Simple request
$tx = $ua->get('metacpan.org');
is $tx->req->method, 'GET', 'right method';
is $tx->req->url, 'http://metacpan.org', 'right url';
is $tx->res->code, 301, 'right status';

# HTTPS request that requires SNI
$tx = $ua->get('https://google.de');
like $ua->ioloop->stream($tx->connection)
->handle->peer_certificate('commonName'), qr/google\.de/, 'right name';

# Simple request with body
$tx = $ua->get('http://mojolicio.us' => 'Hi there!');
Expand Down

0 comments on commit bf39a3a

Please sign in to comment.