mirror of
https://github.com/dani/patrix.git
synced 2024-06-18 12:49:13 +02:00
USe LWP::Protocol::connect to handle https proxy if available
This commit is contained in:
parent
be6cc12f2f
commit
cb688ca984
|
@ -83,13 +83,16 @@ foreach my $action (@actions){
|
||||||
|
|
||||||
my $lwp = LWP::UserAgent->new;
|
my $lwp = LWP::UserAgent->new;
|
||||||
|
|
||||||
|
if (not $opt->{proxy} and defined $ENV{https_proxy}){
|
||||||
|
$opt->{proxy} = $ENV{https_proxy};
|
||||||
|
}
|
||||||
# If a proxy is specified then use it. Else, try to get global one
|
# If a proxy is specified then use it. Else, try to get global one
|
||||||
if ($opt->{proxy}){
|
if ($opt->{proxy}){
|
||||||
|
if (eval { require LWP::Protocol::connect; }){
|
||||||
|
$opt->{proxy} =~ s|^http://(.*)|connect://$1|;
|
||||||
|
}
|
||||||
$lwp->proxy(['https'], $opt->{proxy});
|
$lwp->proxy(['https'], $opt->{proxy});
|
||||||
}
|
}
|
||||||
else{
|
|
||||||
$lwp->env_proxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
my $stdin = 0;
|
my $stdin = 0;
|
||||||
if (!-t STDIN){
|
if (!-t STDIN){
|
||||||
|
|
Loading…
Reference in New Issue
Block a user