kabachaa has asked for the wisdom of the Perl Monks concerning the following question:
I am new to perl, below is the code that I have compiled and run to connect using a proxy to get response from the server which requires a client certificate. I am trying to figure out if issue is with my script or on the other end at the host site. Can someone please look at it and give me some directions how i can debug and see the problem. I get error 500 connection timeout when I run this script. Thanks
500 Connect failed: connect: Connection timed out; Connection timed ou +t header ----Content-Type: text/plain Client-Date: Client-Warning: Internal response response --- Connect failed: connect: Connection timed out; Connection timed out at + /usr/lib/perl5/site_perl/5.8.8/LWP/Protocol/http.pm line 31 $
#!/usr/bin/perl use LWP::UserAgent; use LWP::Simple; use HTTP::Request; use HTTP::Response; use strict; $ENV{PERL_NET_HTTPS_SSL_SOCKET_CLASS}="Net::SSL"; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; my $ua = new LWP::UserAgent; $ua->timeout(30); $ua->agent(""); $ua->proxy('http', 'http://someproxy.com:80/'); my $h = HTTP::Headers->new(); $h->proxy_authorization_basic('userid','passwordforproxyserver'); #actual server trying to connect to #passing a certificate $ua->ssl_opts( # SSL_ca_file => 'caCertificate.pem', verfiy_hostname => 1, SSL_cert_file => '/home/cert/client_cert.crt', ); # make a https request my $req = HTTP::Request->new('GET', 'https://server.com:443', $h); my $res = $ua->request($req); if ($res->is_success){ print " testing \n " . $res->content; } print "header ----" . $res->headers_as_string; print "response ---" . $res->as_string;
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Using LWP Proxy and Client Certificate Connection timeout
by kcott (Archbishop) on Feb 12, 2013 at 07:46 UTC | |
Re: Using LWP Proxy and Client Certificate Connection timeout
by Anonymous Monk on Feb 12, 2013 at 09:20 UTC | |
Re: Using LWP Proxy and Client Certificate Connection timeout
by Khen1950fx (Canon) on Feb 12, 2013 at 11:52 UTC |
Back to
Seekers of Perl Wisdom