问题
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