Subject: | Proxy not respected for HTTPS |
This code:
perl -MFrontier::Client -e 'my $client = Frontier::Client->new(q{url} => q{https://localhost:4433/}, q{proxy} => q{http://localhost:8118/})->call(q{method})'
Connects to localhost:4433 instead of localhost:8118. This is because Frontier::Client::new() passes proxy setting to LWP::UserAgenmt for http schema only.
Attached patch adds support for https schema to.
Subject: | Frontier-RPC-0.07b4p1-Respect-proxy-setting-for-HTTPS.patch |
From c5ffabf72c254ba3c185b0234ca77e0525eed57f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
Date: Tue, 13 Sep 2016 13:00:14 +0200
Subject: [PATCH] Respect proxy setting for HTTPS
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
URLs different from http schema ignored specified proxy. This patch
passes the proxy setting for http and https schemata.
Signed-off-by: Petr PÃsaÅ <ppisar@redhat.com>
---
lib/Frontier/Client.pm | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/Frontier/Client.pm b/lib/Frontier/Client.pm
index 6ea7b60..a7bdce2 100644
--- a/lib/Frontier/Client.pm
+++ b/lib/Frontier/Client.pm
@@ -28,8 +28,10 @@ sub new {
if !defined $self->{'url'};
$self->{'ua'} = LWP::UserAgent->new;
- $self->{'ua'}->proxy('http', $self->{'proxy'})
- if(defined $self->{'proxy'});
+ my @schemes = grep { $self->{'ua'}->is_protocol_supported($_) }
+ qw/http https/;
+ $self->{'ua'}->proxy([@schemes], $self->{'proxy'})
+ if(defined $self->{'proxy'} && @schemes);
$self->{'rq'} = HTTP::Request->new (POST => $self->{'url'});
$self->{'rq'}->header('Content-Type' => 'text/xml');
# Patch to enable basic authentication:
--
2.7.4