On Wed, Sep 10, 2014 at 06:34:48PM +0200, Remi Locherer wrote:
> Hi
>
> The following diff brings Mojolicious to version 5.39. In addition I
> removed the maintainer (not active for this port since couple of years).
>
> There is one issue with the user_agent_online tests (activated by env
> TEST_ONLINE). 6 test (3 scenarios) fail. These test the URLs:
> http://localhost:random_port
> http://127.0.0.1:random_port
> http://[::1]:random_port
>
> This problem can be reproduced with the mojo command:
> remi@mistral:~% mojo get http://127.0.0.1:55743
> Mojo::Reactor::EV: Write failed: Can't call method "on" on an undefined
> value at /usr/local/libdata/perl5/site_perl/Mojo/UserAgent.pm line 124.
>
> There was allready a (different) failure with Mojolicious 4.66 on OpenBSD 5.5:
> remi@typhoon$ mojo get http://localhost:44568
> Mojo::Reactor::EV: Write failed: Mojo::UserAgent: Event "connect" failed:
> addr is not a string at /usr/local/libdata/perl5/site_perl/IO/Socket/IP.pm
> line 678.
> Problem loading URL "http://localhost:44568". (Premature connection close)
>
> I tried the same on a Linux CentOS5 box I have access to with Perl 5.18.1
> and Mojolicious 5.39 and got the expected result:
> rlochere@tux-05$ mojo get http://localhost:34589
> Problem loading URL "http://localhost:34589". (Connection refused)
>
> URLs different from localhost work as expected.
>
> Can somebody with more OpenBSD specific Perl knowledge help?
I looked a bit more into this issue. Mojo is using IO::Socket::INET by
default. If it finds IO::Socket::IP it uses this instead (see
Mojo::IOLoop::Client). This enables IPv6 within Mojolicious. With an
env var mojo can be forced to use IO::Socket::INET.
--> With IO::Socket::IP
remi@mistral:~% mojo get 127.0.0.1:12345
Mojo::Reactor::EV: Write failed: Can't call method "on" on an undefined
value at /usr/local/libdata/perl5/site_perl/Mojo/UserAgent.pm line 122.
--> With IO::Socket::INET
remi@mistral:~% MOJO_NO_IPV6=1 mojo get 127.0.0.1:12345
Problem loading URL "127.0.0.1:12345". (Can't connect: IO::Socket::INET:
connect: Connection refused)
Running the two scripts below shows the different behaviour between the
two modules. In both cases I could observe with tcpdump that a tcp syn
was sent and a tcp rst returned.
remi@mistral:~% cat sock-ip.pl
#!/usr/bin/perl -w
use IO::Socket::IP;
my $sock = IO::Socket::IP->new(
PeerAddr => "127.0.0.1", PeerPort => "8090", Blocking => 0
) or die $@;
remi@mistral:~% ./sock-ip.pl
remi@mistral:~% echo $?
0
remi@mistral:~% cat sock-inet.pl
#!/usr/bin/perl
use IO::Socket::INET;
my $sock = IO::Socket::INET->new(
PeerAddr => "127.0.0.1", PeerPort => "8090", Blocking => 0
) or die $@;
remi@mistral:~% ./sock-inet.pl
IO::Socket::INET: connect: Connection refused at ./sock-inet.pl line 4.
remi@mistral:~% echo $?
61
Why this difference? I could not see this on a Linux box I have access.
It seams to me that the cause is not in p5-Mojolicious and an update of
the port has not to wait for this beeing fixed.
Remi