Skip to content

Commit

Permalink
switched back from IO::Socket::INET6 to IO::Socket::IP for IPv6 support
Browse files Browse the repository at this point in the history
  • Loading branch information
kraih committed Jun 15, 2012
1 parent b95f445 commit 5e40a92
Show file tree
Hide file tree
Showing 16 changed files with 45 additions and 45 deletions.
4 changes: 3 additions & 1 deletion Changes
Expand Up @@ -3,9 +3,11 @@
- Code name "Rainbow", this is a major release.
- Removed Mojolicious::Plugin::I18N so it can be maintained as a separate
distribution.
- Renamed Mojo::CookieJar to Mojo::UserAgent::CookieJar.
- Updated IO::Socket::SSL requirement to 1.75 for IO::Socket::IP support.
- Switched back from IO::Socket::INET6 to IO::Socket::IP for IPv6 support.
- Switched from HMAC-MD5 to HMAC-SHA1 for signed cookies.
- Added support for new HTTP status code.
- Renamed Mojo::CookieJar to Mojo::UserAgent::CookieJar.
- Improved message parser performance slightly.
- Improved documentation. (ichesnokov, sri)
- Improved tests.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/IOLoop.pm
Expand Up @@ -340,9 +340,9 @@ L<Mojo::IOLoop> is a very minimalistic reactor based on L<Mojo::Reactor>, it
has been reduced to the absolute minimal feature set required to build solid
and scalable non-blocking TCP clients and servers.
Optional modules L<EV>, L<IO::Socket::INET6> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also be
disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
A TLS certificate and key are also built right in to make writing test servers
as easy as possible. Also note that for convenience the C<PIPE> signal will be
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojo/IOLoop/Client.pm
Expand Up @@ -5,15 +5,15 @@ use IO::Socket::INET;
use Scalar::Util 'weaken';
use Socket qw(IPPROTO_TCP SO_ERROR TCP_NODELAY);

# IPv6 support requires IO::Socket::INET6
# IPv6 support requires IO::Socket::IP
use constant IPV6 => $ENV{MOJO_NO_IPV6}
? 0
: eval 'use IO::Socket::INET6 2.69 (); 1';
: eval 'use IO::Socket::IP 0.12 (); 1';

# TLS support requires IO::Socket::SSL
use constant TLS => $ENV{MOJO_NO_TLS} ? 0
: eval(IPV6 ? 'use IO::Socket::SSL 1.37 (); 1'
: 'use IO::Socket::SSL 1.37 "inet4"; 1');
: eval(IPV6 ? 'use IO::Socket::SSL 1.75 (); 1'
: 'use IO::Socket::SSL 1.75 "inet4"; 1');
use constant TLS_READ => TLS ? IO::Socket::SSL::SSL_WANT_READ() : 0;
use constant TLS_WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;

Expand Down Expand Up @@ -57,7 +57,7 @@ sub _connect {
);
$options{LocalAddr} = $args->{local_address} if $args->{local_address};
$options{PeerAddr} =~ s/[\[\]]//g if $options{PeerAddr};
my $class = IPV6 ? 'IO::Socket::INET6' : 'IO::Socket::INET';
my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET';
return $self->emit_safe(error => "Couldn't connect.")
unless $handle = $class->new(%options);

Expand All @@ -76,7 +76,7 @@ sub _connect {

# No TLS support
return $self->emit_safe(
error => 'IO::Socket::SSL 1.37 required for TLS support.')
error => 'IO::Socket::SSL 1.75 required for TLS support.')
unless TLS;

# Upgrade
Expand Down Expand Up @@ -199,7 +199,7 @@ implements the following new ones.
$client->connect(address => '127.0.0.1', port => 3000);
Open a socket connection to a remote host. Note that TLS support depends on
L<IO::Socket::SSL> and IPv6 support on L<IO::Socket::INET6>.
L<IO::Socket::SSL> and IPv6 support on L<IO::Socket::IP>.
These options are currently available:
Expand Down
14 changes: 7 additions & 7 deletions lib/Mojo/IOLoop/Server.pm
Expand Up @@ -8,15 +8,15 @@ use IO::Socket::INET;
use Scalar::Util 'weaken';
use Socket qw(IPPROTO_TCP TCP_NODELAY);

# IPv6 support requires IO::Socket::INET6
# IPv6 support requires IO::Socket::IP
use constant IPV6 => $ENV{MOJO_NO_IPV6}
? 0
: eval 'use IO::Socket::INET6 2.69 (); 1';
: eval 'use IO::Socket::IP 0.12 (); 1';

# TLS support requires IO::Socket::SSL
use constant TLS => $ENV{MOJO_NO_TLS} ? 0
: eval(IPV6 ? 'use IO::Socket::SSL 1.37 (); 1'
: 'use IO::Socket::SSL 1.37 "inet4"; 1');
: eval(IPV6 ? 'use IO::Socket::SSL 1.75 (); 1'
: 'use IO::Socket::SSL 1.75 "inet4"; 1');
use constant TLS_READ => TLS ? IO::Socket::SSL::SSL_WANT_READ() : 0;
use constant TLS_WRITE => TLS ? IO::Socket::SSL::SSL_WANT_WRITE() : 0;

Expand Down Expand Up @@ -59,7 +59,7 @@ sub listen {

# Reuse file descriptor
my $handle;
my $class = IPV6 ? 'IO::Socket::INET6' : 'IO::Socket::INET';
my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET';
if (defined $fd) {
$handle = $class->new;
$handle->fdopen($fd, 'r') or croak "Can't open file descriptor $fd: $!";
Expand All @@ -86,7 +86,7 @@ sub listen {

# TLS
return unless $args->{tls};
croak "IO::Socket::SSL 1.37 required for TLS support" unless TLS;
croak "IO::Socket::SSL 1.75 required for TLS support" unless TLS;

# Options
my $options = $self->{tls} = {
Expand Down Expand Up @@ -227,7 +227,7 @@ implements the following new ones.
$server->listen(port => 3000);
Create a new listen socket. Note that TLS support depends on
L<IO::Socket::SSL> and IPv6 support on L<IO::Socket::INET6>.
L<IO::Socket::SSL> and IPv6 support on L<IO::Socket::IP>.
These options are currently available:
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Server/Daemon.pm
Expand Up @@ -298,9 +298,9 @@ Mojo::Server::Daemon - Non-blocking I/O HTTP 1.1 and WebSocket server
L<Mojo::Server::Daemon> is a full featured non-blocking I/O HTTP 1.1 and
WebSocket server with C<IPv6>, C<TLS> and C<libev> support.
Optional modules L<EV>, L<IO::Socket::INET6> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also be
disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook> for more.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Server/Hypnotoad.pm
Expand Up @@ -382,9 +382,9 @@ You can run the exact same command again for automatic hot deployment.
For L<Mojolicious> and L<Mojolicious::Lite> applications it will default to
C<production> mode.
Optional modules L<EV>, L<IO::Socket::INET6> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also be
disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook> for more.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/Server/Morbo.pm
Expand Up @@ -130,9 +130,9 @@ To start applications with it you can use the L<morbo> script.
$ morbo myapp.pl
Server available at http://127.0.0.1:3000.
Optional modules L<EV>, L<IO::Socket::INET6> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also be
disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook> for more.
Expand Down
6 changes: 3 additions & 3 deletions lib/Mojo/UserAgent.pm
Expand Up @@ -604,9 +604,9 @@ Mojo::UserAgent - Non-blocking I/O HTTP 1.1 and WebSocket user agent
L<Mojo::UserAgent> is a full featured non-blocking I/O HTTP 1.1 and WebSocket
user agent with C<IPv6>, C<TLS> and C<libev> support.
Optional modules L<EV>, L<IO::Socket::INET6> and L<IO::Socket::SSL> are
supported transparently and used if installed. Individual features can also be
disabled with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
Optional modules L<EV>, L<IO::Socket::IP> and L<IO::Socket::SSL> are supported
transparently and used if installed. Individual features can also be disabled
with the C<MOJO_NO_IPV6> and C<MOJO_NO_TLS> environment variables.
See L<Mojolicious::Guides::Cookbook> for more.
Expand Down
10 changes: 4 additions & 6 deletions lib/Mojolicious/Command/version.pm
Expand Up @@ -18,9 +18,7 @@ sub run {

# IPv6
my $ipv6
= Mojo::IOLoop::Server::IPV6
? $IO::Socket::INET6::VERSION
: 'not installed';
= Mojo::IOLoop::Server::IPV6 ? $IO::Socket::IP::VERSION : 'not installed';

# TLS
my $tls
Expand All @@ -32,9 +30,9 @@ CORE
Mojolicious ($Mojolicious::VERSION, $Mojolicious::CODENAME)
OPTIONAL
EV ($ev)
IO::Socket::INET6 ($ipv6)
IO::Socket::SSL ($tls)
EV ($ev)
IO::Socket::IP ($ipv6)
IO::Socket::SSL ($tls)
EOF

Expand Down
4 changes: 2 additions & 2 deletions lib/Mojolicious/Guides/FAQ.pod
Expand Up @@ -30,8 +30,8 @@ without compromises. While there are no rules in
L<Mojolicious::Guides::CodingGuidelines> that forbid dependencies, we do
currently discourage adding non-optional ones in favor of a faster and more
painless installation process. And we do in fact already use several optional
CPAN modules such as L<EV>, L<IO::Socket::INET6>, L<IO::Socket::SSL> and
L<Plack> to provide advanced functionality if they are installed.
CPAN modules such as L<EV>, L<IO::Socket::IP>, L<IO::Socket::SSL> and L<Plack>
to provide advanced functionality if they are installed.

=head2 Why reinvent wheels?

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/ioloop_ipv6.t
Expand Up @@ -7,7 +7,7 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_IPV6 to enable this test (developer only!)'
unless $ENV{TEST_IPV6};
plan skip_all => 'IO::Socket::INET6 2.69 required for this test!'
plan skip_all => 'IO::Socket::IP 0.12 required for this test!'
unless Mojo::IOLoop::Server::IPV6;
plan tests => 2;

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/ioloop_tls.t
Expand Up @@ -30,7 +30,7 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
unless $ENV{TEST_TLS};
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
plan skip_all => 'IO::Socket::SSL 1.75 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 28;

Expand Down
4 changes: 2 additions & 2 deletions t/mojo/user_agent_online.t
Expand Up @@ -10,9 +10,9 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_ONLINE to enable this test (developer only!)'
unless $ENV{TEST_ONLINE};
plan skip_all => 'IO::Socket::INET6 2.69 required for this test!'
plan skip_all => 'IO::Socket::IP 0.12 required for this test!'
unless Mojo::IOLoop::Server::IPV6;
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
plan skip_all => 'IO::Socket::SSL 1.75 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 88;

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/user_agent_tls.t
Expand Up @@ -10,7 +10,7 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
unless $ENV{TEST_TLS};
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
plan skip_all => 'IO::Socket::SSL 1.75 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 24;

Expand Down
2 changes: 1 addition & 1 deletion t/mojo/websocket_proxy_tls.t
Expand Up @@ -11,7 +11,7 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
unless $ENV{TEST_TLS};
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
plan skip_all => 'IO::Socket::SSL 1.75 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 17;

Expand Down
2 changes: 1 addition & 1 deletion t/mojolicious/tls_lite_app.t
Expand Up @@ -10,7 +10,7 @@ use Test::More;
use Mojo::IOLoop::Server;
plan skip_all => 'set TEST_TLS to enable this test (developer only!)'
unless $ENV{TEST_TLS};
plan skip_all => 'IO::Socket::SSL 1.37 required for this test!'
plan skip_all => 'IO::Socket::SSL 1.75 required for this test!'
unless Mojo::IOLoop::Server::TLS;
plan tests => 40;

Expand Down

0 comments on commit 5e40a92

Please sign in to comment.