当我使用具有代理设置的Mojo :: UserAgent运行代码时,出现类似“ Mojo :: Reactor :: EV:读取失败:Mojo :: UserAgent:SSL尝试由于握手问题而失败的错误,SSL希望先读取“
use Mojo::UserAgent;
my $M = Mojo::UserAgent->new();
$M->proxy->http(myhost)->https(myhost);
my $url = 'url';
my $got = 0;
START:
my $ts = substr(time(), 3, 6);
$headers = {
'User-Agent' => 'Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:62.0) Gecko/20' . $ts . ' Firefox/62.0'
};
my $tx = undef;
eval { $tx = $M->get($url => $headers )->res->body; };
$got = 1 if $@;
if($got == 1) { sleep(2); goto START; }
else{ print STDERR $tx,"\n"; $got = 0; }