簡體   English   中英

LWP :: UserAgent和代理錯誤

[英]LWP::UserAgent and proxy error

使用LWP :: UserAgent時出現代理錯誤

這是代碼:

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

這是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' );

這是針對請求:

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

問題是響應是一個錯誤:

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

我在WinXP機器上使用ActiveState perl 5.10.1

從瀏覽器訪問鏈接時,它可以工作

有人可以幫忙嗎?

謝謝

我一直需要設置https_proxy(而不僅僅是http_proxy)來使用SSL URI。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM