升级 LWP 后脚本“证书验证失败" [英] Scripts broke after upgrading LWP "certificate verify failed"

查看:56
本文介绍了升级 LWP 后脚本“证书验证失败"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有很多脚本,其中大部分基于 WWW::Mechanize,从可通过 HTTPs 访问的其他硬件中抓取数据.升级我的大部分 perl 安装及其模块后,所有使用 HTTPS://的脚本都因 证书验证失败"

I have a lot of scripts, most of them based around WWW::Mechanize that scrape data off of misc hardware that is accessible via HTTPs. After upgrading most of my perl installation and its modules, all scripts using HTTPS:// broke because of "certificate verify failed"

这是因为较新版本的 LWP 对证书进行了适当的检查,如果不匹配则死亡.

This is a result of the fact that the newer versions of LWP does a proper check on the certificate and dies if something doesn't match.

在我的情况下,由于情况而导致证书身份验证失败,因此我需要找到一种干净地绕过此检查的方法.

In my case, the failed certificate authentication is expected due to the circumstances, so i needed to find a way of cleanly circumventing this check.

推荐答案

我在代码前加上:

$ENV{'PERL_LWP_SSL_VERIFY_HOSTNAME'} = 0;

这导致脚本以一种干净简单的方式绕过检查.

This caused the script to circumvent the check in a clean and simple way.

这篇关于升级 LWP 后脚本“证书验证失败"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆