LWP Useragent中的状态读取失败

时间:2015-10-13 16:08:55

标签: linux perl https operating-system lwp-useragent

案例1: 我的服务器(远程访问无法访问Internet)与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位。 为x86_64-linux-gnu-thread-multi构建的perl 5,version 14,subversion 2(v5.14.2) LWP :: UserAgent - 6.04 HTTP :: Response,HTTP :: Status,HTTP :: Request :: Common版本是 - 6.03。 案例2:我的服务器(在家庭和互联网访问)使用我的互联网连接的静态IP连接。使用我的代理尝试使用下面的代码运行上面的代码。

$ LWPUserAgent->代理(' 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.

1 个答案:

答案 0 :(得分:0)

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