LWP :: UserAgent无法使用TLS1.1发布 [英] LWP::UserAgent Can't Post with TLS1.1
问题描述
通过https获得500个握手错误:443.我向其发送XML的主机服务不支持TLS 1.2,它们支持1.0和1.1.当前在CentOS 6上使用LWP 6.03.使用下面的代码,他们声称我仍在使用TLS1.2发送邮件.
Getting 500 handshaker error:443 over https. The host service I am sending XML to does not support TLS 1.2, they do support 1.0 and 1.1. Currently using LWP 6.03 on CentOS 6. Using the code below they claim I am still sending using TLS1.2
use LWP::UserAgent;
$ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 0,SSL_version => 'SSLv23:!TLSv12' });
$req = HTTP::Request->new(GET => 'https://secure-host-server');
$res = $ua->request($req);
if ($res->is_success) {
print $res->content;
} else {
print "Error: " . $res->status_line . "\n";
}
是否可以在发送到主机时打印TLS版本?我可以做些什么来验证我正在使用TLS1.1?
Is it possible to print the TLS version as it is sent to the host? Anything I can do to verify I am using TLS1.1?
推荐答案
通过LWP :: UserAgent设置SSL_version无效.我尝试了无数种方法来尝试使我的代码通过TLSv1发送XML而没有运气,下面的代码可以解决问题.
Setting SSL_version via LWP::UserAgent would not work. I tried countless methods to try to get my code to send XML via TLSv1 without luck, The following code did the trick.
use Net::SSLGlue::LWP;
use IO::Socket::SSL;
my $context = new IO::Socket::SSL::SSL_Context(
SSL_version => 'tlsv1',
SSL_verify_mode => Net::SSLeay::VERIFY_NONE(),
);
IO::Socket::SSL::set_default_context($context);
use LWP::UserAgent;
use HTTP::Request::Common;
这篇关于LWP :: UserAgent无法使用TLS1.1发布的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!