Here is a simple example. The error only occurs sometimes.
I tested it with some socks proxies from http://proxylist.hidemyass.com/.
my $ua = Mojo::UserAgent->new;
$ua->proxy->http("socks://" . shift);
$ua->get('http://checkip.dyndns.com/', sub {
my($ua, $tx) = @_;
say $tx->req->url;
if(my $e=$tx->error) {
say $e->{message};
}else {
say $tx->res->body;
}
});
Mojo::IOLoop->start;
read: Connection reset by peer
Mojo::Reactor::Poll: Read failed: Mojo::UserAgent: read: Connection reset
by peer at /Library/Perl/5.16/Mojo/EventEmitter.pm line 19.
Mojo::Reactor::Poll: Read failed: Mojo::UserAgent: read: Connection reset
by peer at /Library/Perl/5.16/Mojo/EventEmitter.pm line 19.
Mojo::Reactor::Poll: Read failed: Mojo::UserAgent: read: Connection reset
by peer at /Library/Perl/5.16/Mojo/EventEmitter.pm line 19.
Mojo::Reactor::Poll: Read failed: Mojo::UserAgent: read: Connection reset
by peer at /Library/Perl/5.16/Mojo/EventEmitter.pm line 19.
[...]
--
You received this message because you are subscribed to the Google Groups
"Mojolicious" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/mojolicious.
For more options, visit https://groups.google.com/d/optout.