Ziliang has asked for the wisdom of the Perl Monks concerning the following question:
Hi Monks,
I encountered a LWP::UserAgent problem in Windows, the perl is running version 5.14.2. Running the following code on Ubuntu 12.04 and ReadHat machine both have no problem. Running it on Win7, 64bit encountering issues.
Could you please shed some light here.
Appreciate!
#!/usr/bin/perl use warnings; use strict; use LWP::UserAgent; $ENV{HTTPS_DEBUG} = 1; my @requestHeaders = ( 'Content-type' => 'text/json', 'username' => 'xxx', 'password' => 'yyy' ); my $url = "https://ipaddr:443/dir/dir"; my $ua = LWP::UserAgent->new; $ua->default_header('Accept-Encoding' => scalar HTTP::Message::decodab +le()); $ua->add_handler("request_send", sub { shift->dump; return }); $ua->add_handler("response_done", sub { shift->dump; return }); my $response = $ua->get($url, @requestHeaders); die "Error $url\n".$response->status_line."\n" unless $response->is_su +ccess; print "Success ".$response->content_type. " document!\n";
Windows dump:
GET https://ipaddr:443/dir/file
Accept-Encoding: gzip, x-gzip, deflate, x-bzip2
User-Agent: libwww-perl/6.02
Content-Type: text/json
Password: yyy
Username: xxx
(no content)
500 Can't connect to ipaddr:443
Content-Type: text/plain
Client-Date: Wed, 06 Jun 2012 04:04:37 GMT
Client-Warning: Internal response
Can't connect to ipaddr:443\n
LWP::Protocol::https::Socket: SSL connect attempt failed with unknown errorerror:140773F2:SSL
routines:SSL23_GET_SERVER_HELLO:sslv3 alert unexpected m
essage at C:/Perl64/lib/LWP/Protocol/http.pm line 51.\n
Error https://ipaddr:443/dir/file
500 Can't connect to ipaddr:443
Linux dump:
GET https://ipaddr:443/dir/file
Accept-Encoding: gzip, x-gzip, deflate, x-bzip2
User-Agent: libwww-perl/6.02
Content-Type: text/json
Password: yyy
Username: xxx
(no content)
HTTP/1.1 200 OK
Connection: close
Date: Wed, 06 Jun 2012 04:40:30 GMT
Server: Apache-Coyote/1.1
Content-Type: text/json
Client-Date: Tue, 05 Jun 2012 23:52:26 GMT
Client-Peer: 10.241.164.103:443
Client-Response-Num: 1
Client-SSL-Cert-Issuer: /C=US/ST=Massachusetts/L=Hopkinton/O=EEE/OU=EEE/CN=FNM00105100389/emailAddress=support@EEE.com
Client-SSL-Cert-Subject: /C=US/ST=Massachusetts/O=EEE/OU=EEE/CN=VPlex Web Server:
FNM00105100389/emailAddress=support@EEE.com
Client-SSL-Cipher: EDH-RSA-DES-CBC3-SHA
Client-SSL-Warning: Peer certificate not verified
...
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: LWP::UserAgent failed to function on Win7
by tobyink (Canon) on Jun 06, 2012 at 13:43 UTC | |
by Ziliang (Initiate) on Jun 06, 2012 at 14:10 UTC | |
by Ziliang (Initiate) on Jun 06, 2012 at 14:10 UTC | |
|
Re: LWP::UserAgent failed to function on Win7
by Anonymous Monk on Jun 06, 2012 at 06:36 UTC | |
by Ziliang (Initiate) on Jun 06, 2012 at 15:16 UTC |