1
votes

I have a proxy error when using LWP::UserAgent

this is the code:

my $ua = LWP::UserAgent->new();
$ua->proxy( http => $ENV{HTTP_PROXY});
print Dumper($ua);
my $request = new HTTP::Request('GET', $link);
print Dumper( $request );

and this is the dumper for UserAgent

$VAR1 = bless( {
             'max_redirect' => 7,
             'protocols_forbidden' => undef,
             'show_progress' => undef,
             'handlers' => {
                             'response_header' => bless( [
                                                           {
                                                             'owner' => 'LWP::UserAgent::parse_head',
                                                             'callback' => sub { "DUMMY" },
                                                             'm_media_type' => 'html',
                                                             'line' => 'C:/Perl/lib/LWP/UserAgent.pm:612'
                                                           }
                                                         ], 'HTTP::Config' ),
                             'request_preprepare' => bless( [
                                                              {
                                                                'owner' => 'LWP::UserAgent::proxy',
                                                                'callback' => sub { "DUMMY" },
                                                                'line' => 'C:/Perl/lib/LWP/UserAgent.pm:920'
                                                              }
                                                            ], 'HTTP::Config' )
                           },
             'no_proxy' => [],
             'protocols_allowed' => undef,
             'local_address' => undef,
             'use_eval' => 1,
             'requests_redirectable' => [
                                          'GET',
                                          'HEAD'
                                        ],
             'timeout' => 90,
             'def_headers' => bless( {
                                       'user-agent' => 'libwww-perl/5.837'
                                     }, 'HTTP::Headers' ),
             'proxy' => {
                          'http' => 'http://igate:8080'
                        },
             'max_size' => undef
           }, 'LWP::UserAgent' );

And this is for the request:

$VAR1 = bless( {
             '_content' => '',
             '_uri' => bless( do{\(my $o = 'https://some_link')}, 'URI::https' ),
             '_headers' => bless( {}, 'HTTP::Headers' ),
             '_method' => 'GET'
           }, 'HTTP::Request' );

the problem is that the response is an error:

FAIL response, 500 proxy connect failed: PROXY ERROR HEADER, could be non-SSL URL:
HTTP/1.1 503 Service Unavailable

I'm using ActiveState perl 5.10.1 on a WinXP machine

when accessing the link from browser it work

Can somebody help?

Thanks

1
what's $link value? "https: //some_link" looks a bad URLMiguel Prz
indeed $link is "some_link" from HTTP::Request object, I replaced it because I can't give you the real link. I assure I'm not scraping information from the 'net, just from am inside web-appAndrei Doanca

1 Answers

0
votes

I've always needed to set https_proxy (rather than just http_proxy) to work with SSL URIs.