-
-
Save anonymous/ce9606650d378e939bef to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Makefile.PL b/Makefile.PL | |
index a543098..0215dc1 100644 | |
--- a/Makefile.PL | |
+++ b/Makefile.PL | |
@@ -7,6 +7,7 @@ use ExtUtils::MakeMaker; | |
# Pod::Simple 3.09 first shipped with Perl 5.11.2 | |
# Time::Local 1.2 first shipped with Perl 5.13.9 | |
+# IO::Socket::IP 0.26 first shipped with Perl 5.19.8 | |
WriteMakefile( | |
NAME => 'Mojolicious', | |
VERSION_FROM => 'lib/Mojolicious.pm', | |
@@ -24,7 +25,11 @@ WriteMakefile( | |
}, | |
no_index => {directory => ['t']} | |
}, | |
- PREREQ_PM => {'Pod::Simple' => '3.09', 'Time::Local' => '1.2'}, | |
+ PREREQ_PM => { | |
+ 'IO::Socket::IP' => '0.26', | |
+ 'Pod::Simple' => '3.09', | |
+ 'Time::Local' => '1.2' | |
+ }, | |
EXE_FILES => ['script/hypnotoad', 'script/mojo', 'script/morbo'], | |
test => {TESTS => 't/*.t t/*/*.t'} | |
); | |
diff --git a/README.md b/README.md | |
index d276a51..159de7c 100644 | |
--- a/README.md | |
+++ b/README.md | |
@@ -18,7 +18,7 @@ | |
testing framework, static file server, first class Unicode support and | |
much more for you to discover. | |
* Very clean, portable and object-oriented pure-Perl API with no hidden | |
- magic and no requirements besides Perl 5.18.0 (versions as old as 5.10.1 | |
+ magic and no requirements besides Perl 5.20.0 (versions as old as 5.10.1 | |
can be used too, but may require additional CPAN modules to be installed) | |
* Full stack HTTP and WebSocket client/server implementation with IPv6, TLS, | |
SNI, IDNA, HTTP/SOCKS5 proxy, Comet (long polling), keep-alive, connection | |
diff --git a/lib/Mojo/IOLoop.pm b/lib/Mojo/IOLoop.pm | |
index 118bd05..dc9d3f6 100644 | |
--- a/lib/Mojo/IOLoop.pm | |
+++ b/lib/Mojo/IOLoop.pm | |
@@ -324,12 +324,11 @@ right in, to make writing test servers as easy as possible | |
convenience the C<PIPE> signal will be set to C<IGNORE> when L<Mojo::IOLoop> | |
is loaded. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"REAL-TIME WEB"> for more. | |
diff --git a/lib/Mojo/IOLoop/Client.pm b/lib/Mojo/IOLoop/Client.pm | |
index 6163edb..626a29d 100644 | |
--- a/lib/Mojo/IOLoop/Client.pm | |
+++ b/lib/Mojo/IOLoop/Client.pm | |
@@ -2,16 +2,11 @@ package Mojo::IOLoop::Client; | |
use Mojo::Base 'Mojo::EventEmitter'; | |
use Errno 'EINPROGRESS'; | |
-use IO::Socket::INET; | |
+use IO::Socket::IP; | |
use Mojo::IOLoop; | |
use Scalar::Util 'weaken'; | |
use Socket qw(IPPROTO_TCP TCP_NODELAY); | |
-# IPv6 support requires IO::Socket::IP | |
-use constant IPV6 => $ENV{MOJO_NO_IPV6} | |
- ? 0 | |
- : eval 'use IO::Socket::IP 0.20 (); 1'; | |
- | |
# TLS support requires IO::Socket::SSL | |
use constant TLS => $ENV{MOJO_NO_TLS} | |
? 0 | |
@@ -59,9 +54,8 @@ sub _connect { | |
); | |
$options{LocalAddr} = $args->{local_address} if $args->{local_address}; | |
$options{PeerAddr} =~ s/[\[\]]//g if $options{PeerAddr}; | |
- my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET'; | |
return $self->emit(error => "Can't connect: $@") | |
- unless $self->{handle} = $handle = $class->new(%options); | |
+ unless $self->{handle} = $handle = IO::Socket::IP->new(%options); | |
} | |
$handle->blocking(0); | |
@@ -244,7 +238,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> (1.84+) and IPv6 support on L<IO::Socket::IP> (0.20+). | |
+L<IO::Socket::SSL> (1.84+). | |
These options are currently available: | |
diff --git a/lib/Mojo/IOLoop/Server.pm b/lib/Mojo/IOLoop/Server.pm | |
index fc5c9ad..26a2d11 100644 | |
--- a/lib/Mojo/IOLoop/Server.pm | |
+++ b/lib/Mojo/IOLoop/Server.pm | |
@@ -4,16 +4,11 @@ use Mojo::Base 'Mojo::EventEmitter'; | |
use Carp 'croak'; | |
use File::Basename 'dirname'; | |
use File::Spec::Functions 'catfile'; | |
-use IO::Socket::INET; | |
+use IO::Socket::IP; | |
use Mojo::IOLoop; | |
use Scalar::Util 'weaken'; | |
use Socket qw(IPPROTO_TCP TCP_NODELAY); | |
-# IPv6 support requires IO::Socket::IP | |
-use constant IPV6 => $ENV{MOJO_NO_IPV6} | |
- ? 0 | |
- : eval 'use IO::Socket::IP 0.20 (); 1'; | |
- | |
# TLS support requires IO::Socket::SSL | |
use constant TLS => $ENV{MOJO_NO_TLS} | |
? 0 | |
@@ -38,7 +33,7 @@ sub DESTROY { | |
} | |
sub generate_port { | |
- IO::Socket::INET->new(Listen => 5, LocalAddr => '127.0.0.1')->sockport; | |
+ IO::Socket::IP->new(Listen => 5, LocalAddr => '127.0.0.1')->sockport; | |
} | |
sub handle { shift->{handle} } | |
@@ -59,9 +54,8 @@ sub listen { | |
# Reuse file descriptor | |
my $handle; | |
- my $class = IPV6 ? 'IO::Socket::IP' : 'IO::Socket::INET'; | |
if (defined $fd) { | |
- $handle = $class->new_from_fd($fd, 'r') | |
+ $handle = IO::Socket::IP->new_from_fd($fd, 'r') | |
or croak "Can't open file descriptor $fd: $!"; | |
} | |
@@ -76,7 +70,8 @@ sub listen { | |
); | |
$options{LocalPort} = $port if $port; | |
$options{LocalAddr} =~ s/[\[\]]//g; | |
- $handle = $class->new(%options) or croak "Can't create listen socket: $@"; | |
+ $handle = IO::Socket::IP->new(%options) | |
+ or croak "Can't create listen socket: $@"; | |
$fd = fileno $handle; | |
my $reuse = $self->{reuse} = join ':', $address, $handle->sockport, $fd; | |
$ENV{MOJO_REUSE} .= length $ENV{MOJO_REUSE} ? ",$reuse" : "$reuse"; | |
@@ -238,7 +233,7 @@ Get handle for server. | |
$server->listen(port => 3000); | |
Create a new listen socket. Note that TLS support depends on | |
-L<IO::Socket::SSL> (1.84+) and IPv6 support on L<IO::Socket::IP> (0.20+). | |
+L<IO::Socket::SSL> (1.84+). | |
These options are currently available: | |
diff --git a/lib/Mojo/Server/Daemon.pm b/lib/Mojo/Server/Daemon.pm | |
index 12f6a02..3b3563b 100644 | |
--- a/lib/Mojo/Server/Daemon.pm | |
+++ b/lib/Mojo/Server/Daemon.pm | |
@@ -264,12 +264,11 @@ L<Mojo::Server::Daemon> is a full featured, highly portabl | |
HTTP and WebSocket server, with IPv6, TLS, Comet (long polling), keep-alive | |
and multiple event loop support. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more. | |
diff --git a/lib/Mojo/Server/Hypnotoad.pm b/lib/Mojo/Server/Hypnotoad.pm | |
index 71119fc..acdf9e6 100644 | |
--- a/lib/Mojo/Server/Hypnotoad.pm | |
+++ b/lib/Mojo/Server/Hypnotoad.pm | |
@@ -171,12 +171,11 @@ You can run the same command again for automatic hot deplo | |
This second invocation will load the application again, detect the process id | |
file with it, and send a L</"USR2"> signal to the already running server. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more. | |
diff --git a/lib/Mojo/Server/Morbo.pm b/lib/Mojo/Server/Morbo.pm | |
index 967bdf9..d6bff18 100644 | |
--- a/lib/Mojo/Server/Morbo.pm | |
+++ b/lib/Mojo/Server/Morbo.pm | |
@@ -130,12 +130,11 @@ To start applications with it you can use the L<morbo> scr | |
$ morbo ./myapp.pl | |
Server available at http://127.0.0.1:3000. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more. | |
diff --git a/lib/Mojo/Server/Prefork.pm b/lib/Mojo/Server/Prefork.pm | |
index b9ffc9d..89a0343 100644 | |
--- a/lib/Mojo/Server/Prefork.pm | |
+++ b/lib/Mojo/Server/Prefork.pm | |
@@ -261,12 +261,11 @@ keep-alive and multiple event loop support. Note that the | |
for process management, so you should avoid modifying signal handlers in your | |
applications. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"DEPLOYMENT"> for more. | |
diff --git a/lib/Mojo/UserAgent.pm b/lib/Mojo/UserAgent.pm | |
index 190b733..38e9e10 100644 | |
--- a/lib/Mojo/UserAgent.pm | |
+++ b/lib/Mojo/UserAgent.pm | |
@@ -440,12 +440,11 @@ All connections will be reset automatically if a new proce | |
this allows multiple processes to share the same L<Mojo::UserAgent> object | |
safely. | |
-For better scalability (epoll, kqueue) and to provide IPv6, SOCKS5 as well as | |
-TLS support, the optional modules L<EV> (4.0+), L<IO::Socket::IP> (0.20+), | |
-L<IO::Socket::Socks> (0.64+) and L<IO::Socket::SSL> (1.84+) will be used | |
-automatically if they are installed. Individual features can also be disabled | |
-with the C<MOJO_NO_IPV6>, C<MOJO_NO_SOCKS> and C<MOJO_NO_TLS> environment | |
-variables. | |
+For better scalability (epoll, kqueue) and to provide SOCKS5 as well as TLS | |
+support, the optional modules L<EV> (4.0+), L<IO::Socket::Socks> (0.64+) and | |
+L<IO::Socket::SSL> (1.84+) will be used automatically if they are installed. | |
+Individual features can also be disabled with the C<MOJO_NO_SOCKS> and | |
+C<MOJO_NO_TLS> environment variables. | |
See L<Mojolicious::Guides::Cookbook/"USER AGENT"> for more. | |
diff --git a/lib/Mojolicious/Command/version.pm b/lib/Mojolicious/Command/versio | |
index 4bdd363..cf68172 100644 | |
--- a/lib/Mojolicious/Command/version.pm | |
+++ b/lib/Mojolicious/Command/version.pm | |
@@ -13,7 +13,6 @@ sub run { | |
my $ev = eval 'use Mojo::Reactor::EV; 1' ? $EV::VERSION : 'not installed'; | |
my $class = 'Mojo::IOLoop::Client'; | |
- my $ipv6 = $class->IPV6 ? $IO::Socket::IP::VERSION : 'not installed'; | |
my $socks = $class->SOCKS ? $IO::Socket::Socks::VERSION : 'not installed'; | |
my $tls = $class->TLS ? $IO::Socket::SSL::VERSION : 'not installed'; | |
@@ -24,7 +23,6 @@ CORE | |
OPTIONAL | |
EV 4.0+ ($ev) | |
- IO::Socket::IP 0.20+ ($ipv6) | |
IO::Socket::Socks 0.64+ ($socks) | |
IO::Socket::SSL 1.84+ ($tls) | |
diff --git a/lib/Mojolicious/Guides/FAQ.pod b/lib/Mojolicious/Guides/FAQ.pod | |
index a9b028d..9d3d590 100644 | |
--- a/lib/Mojolicious/Guides/FAQ.pod | |
+++ b/lib/Mojolicious/Guides/FAQ.pod | |
@@ -34,9 +34,8 @@ without compromises. While there are no rules in | |
L<Mojolicious::Guides::Contributing> 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::IP>, L<IO::Socket::Socks>, | |
-L<IO::Socket::SSL> and L<Plack> to provide advanced functionality if they are | |
-installed. | |
+modules such as L<EV>, L<IO::Socket::Socks>, L<IO::Socket::SSL> and L<Plack> | |
+to provide advanced functionality if they are installed. | |
=head2 Why reinvent wheels? | |
diff --git a/t/mojo/ioloop_ipv6.t b/t/mojo/ioloop_ipv6.t | |
index 11be547..a589a41 100644 | |
--- a/t/mojo/ioloop_ipv6.t | |
+++ b/t/mojo/ioloop_ipv6.t | |
@@ -7,8 +7,6 @@ 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::IP 0.20 required for this test!' | |
- unless Mojo::IOLoop::Server::IPV6; | |
use Mojo::IOLoop; | |
diff --git a/t/mojo/user_agent_online.t b/t/mojo/user_agent_online.t | |
index 93df947..56a5802 100644 | |
--- a/t/mojo/user_agent_online.t | |
+++ b/t/mojo/user_agent_online.t | |
@@ -10,8 +10,6 @@ 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::IP 0.20 required for this test!' | |
- unless Mojo::IOLoop::Server::IPV6; | |
plan skip_all => 'IO::Socket::SSL 1.84 required for this test!' | |
unless Mojo::IOLoop::Server::TLS; | |
@@ -87,7 +85,7 @@ ok $tx->error, 'has error'; | |
$tx = $ua->build_tx(GET => 'http://cdeabcdeffoobarnonexisting.com'); | |
$ua->start($tx); | |
ok $tx->is_finished, 'transaction is finished'; | |
-like $tx->error->{message}, qr/^Can't connect/, 'right error'; | |
+ok $tx->error, 'has error'; | |
# Fresh user agent again | |
$ua = Mojo::UserAgent->new; | |
diff --git a/t/pod_coverage.t b/t/pod_coverage.t | |
index 50f8fcd..6beb9b4 100644 | |
--- a/t/pod_coverage.t | |
+++ b/t/pod_coverage.t | |
@@ -14,4 +14,4 @@ my @tiger = ( | |
); | |
# False positive constants | |
-all_pod_coverage_ok({also_private => [qw(IPV6 TLS), @tiger]}); | |
+all_pod_coverage_ok({also_private => ['TLS', @tiger]}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment