https / proxy problem

https / proxy problem

am 11.01.2006 16:59:03 von 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)

Anybody know why I can't reach remote https sites?

Re: https / proxy problem (LWP::UserAgent)

am 11.01.2006 17:27:21 von Juha Laiho

"Larry" said:
>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".

Could it be that LWP does not support HTTP 'CONNECT' method for working
with proxies? As it is this what is needed to proxy https requests:
you first make a 'CONNECT' request to the proxy, and then place your
https traffic in the connection that the proxy opened for you.
--
Wolf a.k.a. Juha Laiho Espoo, Finland
(GC 3.0) GIT d- s+: a C++ ULSH++++$ P++@ L+++ E- W+$@ N++ !K w !O !M V
PS(+) PE Y+ PGP(+) t- 5 !X R !tv b+ !DI D G e+ h---- r+++ y++++
"...cancel my subscription to the resurrection!" (Jim Morrison)