reegan vijay
reegan vijay

Reputation: 122

Status read failed in LWP Useragent

Case 1: My server (accessing remotely does not have internet access) having the connectivity to the remote server in 443 port. Using web service URL, I need to send the web service request and receive the response. I am able to send the request using but unable to receive the response from remote server. code: Here is my code which i am using to send and receive the https request using the lwp agent in perl

  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 ;

I printed the response using Data::Dumper and getting below response.

 $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' );

I searched more about this in google and i am unable to found any idea about this. My server information are : OS - wheezy 7.2 64bit. perl 5, version 14, subversion 2 (v5.14.2) built for x86_64-linux-gnu-thread-multi LWP::UserAgent - 6.04 HTTP::Response,HTTP::Status,HTTP::Request::Common versions are - 6.03. Case 2: My server (in home and internet access) having the connectivity using my static ip of the internet connection. Using my proxy trying to run the above code with below piece of code.

$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.

Upvotes: 3

Views: 1364

Answers (1)

Sergun_spb
Sergun_spb

Reputation: 101

Please set $ENV{HTTPS_DEBUG} = 1; and write here what the script prints.

Upvotes: 0

Related Questions