Skip to content

Commit

Permalink
fixed Mojo::IOLoop to not connect to TLS hosts without checking TLS s…
Browse files Browse the repository at this point in the history
…upport first
  • Loading branch information
kraih committed Jun 23, 2010
1 parent b255344 commit 7866ff6
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -29,6 +29,8 @@ This file documents the revision history for Perl extension Mojolicious.
MojoX::Dispatcher::Routes. (DaTa)
- Fixed route rendering bug. (koban)
- Fixed small url_for bug.
- Fixed Mojo::IOLoop to not connect to TLS hosts without checking TLS
support first. (ashleydev)

0.999926 2010-06-07 00:00:00
- Added version requirement for all optional dependencies.
Expand Down
3 changes: 3 additions & 0 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -134,6 +134,9 @@ sub connect {
# Arguments
my $args = ref $_[0] ? $_[0] : {@_};

# TLS check
return if $args->{tls} && !TLS;

# Options
my %options = (
Blocking => 0,
Expand Down
2 changes: 2 additions & 0 deletions lib/Mojolicious.pm
Expand Up @@ -628,6 +628,8 @@ Andy Grundman
Aristotle Pagaltzis
Ashley Dev
Ask Bjoern Hansen
Audrey Tang
Expand Down
9 changes: 8 additions & 1 deletion t/mojo/client.t
Expand Up @@ -5,12 +5,15 @@
use strict;
use warnings;

# Disable epoll, kqueue and IPv6
BEGIN { $ENV{MOJO_POLL} = $ENV{MOJO_NO_IPV6} = $ENV{MOJO_NO_TLS} = 1 }

use Test::More;

plan skip_all =>
'set TEST_CLIENT to enable this test (internet connection required!)'
unless $ENV{TEST_CLIENT};
plan tests => 80;
plan tests => 81;

# So then I said to the cop, "No, you're driving under the influence...
# of being a jerk".
Expand Down Expand Up @@ -65,6 +68,10 @@ is($method, 'GET', 'right method');
is($url, 'http://cpan.org', 'right url');
is($code, 301, 'right status');

# HTTPS request without TLS support
$tx = $client->get('https://www.google.com');
is($tx->has_error, 1, 'request failed');

# Simple request with body
$tx = $client->get('http://www.apache.org' => 'Hi there!');
is($tx->req->method, 'GET', 'right method');
Expand Down

0 comments on commit 7866ff6

Please sign in to comment.