gpt4 book ai didi

linux - LWP 用户代理中的状态读取失败

转载 作者:太空狗 更新时间:2023-10-29 11:21:48 25 4
gpt4 key购买 nike

案例一:我的服务器(远程访问没有互联网访问权限)在 443 端口连接到远程服务器。使用 Web 服务 URL,我需要发送 Web 服务请求并接收响应。我能够使用但无法从远程服务器接收响应来发送请求。代码:这是我使用 perl 中的 lwp 代理发送和接收 https 请求的代码

  use Data::Dumper;
use LWP::UserAgent;
use HTTP::Status;
use HTTP::Response;
use HTTP::Request::Common;
$ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0;
$LWPUserAgent = new LWP::UserAgent( 'timeout' => '20');
$LWPUserAgent->ssl_opts('verify_hostname' => 0) ;
$WEB_URL="https://webserviceurl.com/Request?Arg1|Arg2|Arg3|Arg4";
$Response = $LWPUserAgent->get($WEB_URL);
print Dumper $Response ;

我使用 Data::Dumper 打印响应并得到以下响应。

 $VAR1 = bless( {
'_content' => 'Status read failed: at /usr/share/perl5/Net/HTTP/Methods.pm line 269.',
'_rc' => 500,
'_headers' => bless( {
'client-warning' => 'Internal response',
'client-date' => 'Tue, 13 Oct 2015 15:13:21 GMT',
'content-type' => 'text/plain'
}, 'HTTP::Headers' ),
'_msg' => 'Status read failed: ',
'_request' => bless( {
'_content' => '',
'_uri' => bless( do{\(my $o = 'https://webserviceurl.com/Request?Arg1%7Arg2%7Arg3%7Arg4')}, 'URI::https' ),
'_headers' => bless( {
'user-agent' => 'libwww-perl/6.04'
}, 'HTTP::Headers' ),
'_method' => 'GET'
}, 'HTTP::Request' )
}, 'HTTP::Response' );

我在谷歌上搜索了更多关于这个的信息,但我找不到任何关于这个的想法。我的服务器信息是:操作系统 - wheezy 7.2 64 位。perl 5,版本 14,颠覆 2 (v5.14.2) 为 x86_64-linux-gnu-thread-multi 构建LWP::用户代理 - 6.04HTTP::Response,HTTP::Status,HTTP::Request::Common versions are - 6.03.情况 2:我的服务器(在家里和互联网访问中)使用我的互联网连接的静态 IP 进行连接。使用我的代理尝试用下面的代码运行上面的代码。

$LWPUserAgent->proxy('https', 'http://192.168.12.10:3128') ;

I am able to send and receive the https requests using LWP agent and working fine. 
My server information are:
OS - squeeze (6.0.6) 32 bit
perl, v5.10.1 (*) built for i486-linux-gnu-thread-multi
LWP::UserAgent - 6.13
HTTP::Response - 5.836
HTTP::Status - 5.817
HTTP::Request::Common - 5.824

I confused of the these things.
1.OS problem
2.Package versions problem
3.whether is it a bug in wheezy
If any one can provide me the correct direction to resolve this it would be highly appreciated.

最佳答案

请设置 $ENV{HTTPS_DEBUG} = 1; 并在此处写下脚本打印的内容。

关于linux - LWP 用户代理中的状态读取失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33107551/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com