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

    From version 6 of LWP (you have 6.02), HTTPS support was split out into a separate distribution. Make sure LWP::Protocol::https is installed on your Windows machine.

    perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'
      Thanks! I verified that LWP::Protocol::http 6.02 has been installed on my Win7.

      Thanks! I verified that LWP::Protocol::http 6.02 has been installed on my Win7.

Re: LWP::UserAgent failed to function on Win7
by Anonymous Monk on Jun 06, 2012 at 06:36 UTC

    You (or ipaddr:443) probably need to upgrade your openssl libraries

      hmmm..., may I ask how to upgrade the openssl lib ? I download the openssl installer on www.openssl.org and after installing, there are butches of dll under GnuWin32 dir.