perl 500 proxy connect failed: PROXY ERROR HEADER, could be non-SSL URL

青春壹個敷衍的年華 提交于 2019-12-11 09:13:55

问题


have a problem when i try to connect with web service that have certification , username and password as credentials

500 proxy connect failed: PROXY ERROR HEADER, could be non-SSL URL

My code is below:

use LWP::Debug qw(+);
use HTTP::Request::Common;
use Crypt::SSLeay;
use HTTP::Headers;
use HTTP::Request;
use LWP;
$url = "https://ip:port/service";
my $ua = new LWP::UserAgent;
$ENV{HTTPS_DEBUG}          = 1;
$ENV{HTTPS_PROXY}          = 'https://ip:port';
$ENV{HTTPS_PROXY_USERNAME} = "username";
$ENV{HTTPS_PROXY_PASSWORD} = "password";
$ENV{HTTPS_CA_FILE}        = 'cert.crt';
$ENV{HTTPS_CA_DIR}         = '/passof/cert/';
$ENV{HTTPS_VERSION}        = '3';

my $message = '<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/e
nvelope/" xmlns:aud="https://ip:port/">
   <soapenv:Body>
      any /////
   </soapenv:Body>
</soapenv:Envelope>';

my $userAgent = LWP::UserAgent->new();
my $request = HTTP::Request->new( GET => 'https://ip:port/service' );
$request->header( SOAPAction => '"https://ip:port/action"' );
$request->content($message);
$request->content_type("text/xml; charset=utf-8");
my $response = $userAgent->request($request);
if ( $response->code == 200 ) {
    print $response->as_string;
}

来源:https://stackoverflow.com/questions/25709925/perl-500-proxy-connect-failed-proxy-error-header-could-be-non-ssl-url

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!