#!/usr/bin/perl -w use strict; use warnings; use Data::Dumper; use LWP::UserAgent; use Crypt::SSLeay; use Net::SSL (); # From Crypt-SSLeay $Net::HTTPS::SSL_SOCKET_CLASS = "Net::SSL"; # Force use of Net::SSL (?) my $proxyinfo='http://bday:adsfa3@144.92.221.19'; $ENV{HTTPS_VERSION} = '2'; $ENV{HTTP_PROXY} = $proxyinfo; $ENV{HTTPS_PROXY} = $proxyinfo; $ENV{PERL_LWP_SSL_VERIFY_HOSTNAME} = 0; $ENV{PERL_LWP_ENV_PROXY} = $proxyinfo; my $ua; my $url = 'https://mail.google.com'; print "--------------------------- Test #1: $url ---------------------------\n"; $ua = LWP::UserAgent->new(show_progress=>1); $ua->cookie_jar( {} ); $ua->protocols_allowed( [ 'http','https'] ); $ua->env_proxy; # $ua->proxy(['https'], $proxyinfo); my $req = HTTP::Request->new('GET',$url); print Dumper($req); my $res = $ua->request($req); print $res->status_line; print $res->as_string; #$url = 'https://www.helsinki.fi/'; $url = 'http://mail.google.com/'; print "--------------------------- Test #2: $url ---------------------------\n"; #my $ua = LWP::UserAgent->new(ssl_opts => { verify_hostname => 1 }); #$ua->protocols_allowed( [ 'http', 'https'] ); #bd added - may be unnecessary $res = $ua->get( $url ); $res->is_success or die "Failed to GET '$url': ", $res->status_line; print $res->as_string; print "--------------------------- SSL in \%INC ---------------------------\n"; print "$_\n" for grep { $_ =~ /SSL/ } keys %INC; #### Name "Net::HTTPS::SSL_SOCKET_CLASS" used only once: possible typo at ./lwpssltest.pl line 8. --------------------------- Test #1: https://mail.google.com --------------------------- $VAR1 = bless( { '_content' => '', '_uri' => bless( do{\(my $o = 'https://mail.google.com')}, 'URI::https' ), '_headers' => bless( {}, 'HTTP::Headers' ), '_method' => 'GET' }, 'HTTP::Request' ); ** GET https://mail.google.com ==> 400 Bad Request (1s) 400 Bad RequestHTTP/1.1 400 Bad Request Cache-Control: no-cache Connection: close Pragma: no-cache Content-Length: 691 Content-Type: text/html; charset=utf-8 Client-Date: Mon, 24 Sep 2012 14:31:14 GMT Client-Peer: 144.72.231.19:80 Client-Response-Num: 1 Proxy-Connection: close Title: Request Error Request Error
Request Error (invalid_request)

Your request could not be processed. Request could not be handled
This could be caused by a misconfiguration, or possibly a malformed request.

For assistance, contact your network support team.
--------------------------- Test #2: http://mail.google.com/ --------------------------- ** GET http://mail.google.com/ ==> 200 OK HTTP/1.1 200 OK Cache-Control: private, max-age=604800 Connection: close Date: Mon, 24 Sep 2012 14:31:14 GMT Server: GSE Content-Length: 232 Content-Type: text/html; charset=ISO-8859-1 Expires: Mon, 24 Sep 2012 14:31:14 GMT Client-Date: Mon, 24 Sep 2012 14:31:14 GMT Client-Peer: 144.72.231.19:80 Client-Response-Num: 1 Refresh: 0;URL=http://mail.google.com/mail/ X-Content-Type-Options: nosniff X-Frame-Options: SAMEORIGIN X-XSS-Protection: 1; mode=block --------------------------- SSL in %INC --------------------------- Crypt/SSLeay.pm Crypt/SSLeay/X509.pm Net/SSL.pm ##
## SunOS 5.10 Perl v5.10.1. LWP 6.04 Crypt::SSLeay 0.57 Net::SSL 2.84 LWP::UserAgent 6.04 LWP::Protocol::https 6.03