首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >LWP Useragent中的状态读取失败

LWP Useragent中的状态读取失败
EN

Stack Overflow用户
提问于 2015-10-14 00:08:55
回答 1查看 1K关注 0票数 3

案例1:我的服务器(远程访问不能访问互联网)通过443端口连接到远程服务器。使用web服务URL,我需要发送web服务请求并接收响应。我可以发送请求使用,但无法从远程服务器接收响应。代码:下面是我使用perl中的lwp代理发送和接收https请求的代码

代码语言:javascript
复制
  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打印了响应,并获得了下面的响应。

代码语言:javascript
复制
 $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' );

我在谷歌上搜索了更多关于这方面的信息,但我找不到任何关于这方面的想法。我的服务器信息是: OS - wheezy 7.2 64bit。为x86_64-linux-gnu-thread-multi LWP::UserAgent - 6.04 HTTP::Response,HTTP::Status,HTTP::Request::Common版本构建的perl 5,version 14,subversion 2 (v5.14.2)是- 6.03。情况2:我的服务器(在家中和互联网接入中)具有使用互联网连接的静态ip的连接性。使用我的代理尝试用下面的代码运行上面的代码。

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

代码语言:javascript
复制
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.
EN

回答 1

Stack Overflow用户

发布于 2015-10-14 20:03:36

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

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/33107551

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档