LWP and firewall

L

Larry

I have a script on Windows which uses LWP to make a simple GET request
through a proxy:

#!/usr/bin/perl

use strict;
use warnings;
use LWP::UserAgent;

my $url = "https://mysite.com";

my $ua = LWP::UserAgent->new;
$ua->proxy(['http', 'https'] => 'http://myproxy.org:80');
my $response = $ua->get( $url );

$response->is_success or
die "Failed to GET '$url': ", $response->status_line;

print $response->as_string, "\n";


I also have Crypt::SSLeay installed so that I can access https sites.
When I try to run the script as above, it prints some HTTP headers and
an HTML-formatted error message from the firewall server which says
"Scheme not supported".

However:

-If I change $url to point to a an http site, the script will
successfully fetch the page, and

- If I change $url to point to an internal https server and comment out
the proxy setting line, the script will successfully get the internal
page.

I checked my proxy settinng in Internet Explorer and both http and
https are set to myproxy.org on port 80 (server name changed to protect
privacy)
 
X

Xicheng

You may need to add one line before setting $ua->proxy to make sure you
can use those proxies in your system...... I dont have a chance to test
it anyway...:)

my $ua = LWP::UserAgent->new;
$ua->env_proxy;
.......
Good luck,
Xicheng
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top