diff --git a/Changes b/Changes index 4621c5c82c..81361100ef 100644 --- a/Changes +++ b/Changes @@ -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. diff --git a/lib/Mojo/IOLoop.pm b/lib/Mojo/IOLoop.pm index 654e15c4bb..6a269734ca 100644 --- a/lib/Mojo/IOLoop.pm +++ b/lib/Mojo/IOLoop.pm @@ -134,6 +134,9 @@ sub connect { # Arguments my $args = ref $_[0] ? $_[0] : {@_}; + # TLS check + return if $args->{tls} && !TLS; + # Options my %options = ( Blocking => 0, diff --git a/lib/Mojolicious.pm b/lib/Mojolicious.pm index 21a7d9be75..e712196d20 100644 --- a/lib/Mojolicious.pm +++ b/lib/Mojolicious.pm @@ -628,6 +628,8 @@ Andy Grundman Aristotle Pagaltzis +Ashley Dev + Ask Bjoern Hansen Audrey Tang diff --git a/t/mojo/client.t b/t/mojo/client.t index bcf70f0a62..d0e061a54a 100644 --- a/t/mojo/client.t +++ b/t/mojo/client.t @@ -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". @@ -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');