简体   繁体   English

如何忽略 perl 中的“证书验证失败”错误?

[英]How to ignore 'Certificate Verify Failed' error in perl?

I want to access a website where the certificate cannot be verified.我想访问无法验证证书的网站。 I'm using WWW::Mechanize get request.我正在使用 WWW::Mechanize 获取请求。 So how would go about ignoring this and continues to connect to the website?那么 go 会如何忽略这一点并继续连接到网站呢?

use IO::Socket::SSL qw();
use WWW::Mechanize qw();
my $mech = WWW::Mechanize->new(ssl_opts => {
    SSL_verify_mode => IO::Socket::SSL::SSL_VERIFY_NONE,
    verify_hostname => 0, # this key is likely going to be removed in future LWP >6.04
});

With IO::Socket::SSL earlier than 1.79, see PERL_LWP_SSL_VERIFY_HOSTNAME .对于早于 1.79 的 IO::Socket::SSL,请参阅PERL_LWP_SSL_VERIFY_HOSTNAME

my $mech = WWW::Mechanize->new( 'ssl_opts' => { 'verify_hostname' => 0 } );

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM