From 581679ad6bce349178fc9baea65ff521838c63eb Mon Sep 17 00:00:00 2001 From: Yadd Date: Fri, 4 Mar 2022 08:26:07 +0100 Subject: [PATCH] Set env_proxy=1 to LLNG::UserAgent (#2715) --- lemonldap-ng-common/lib/Lemonldap/NG/Common/UserAgent.pm | 5 +++-- lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GitHub.pm | 1 - lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/LinkedIn.pm | 1 - lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Twitter.pm | 1 - lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/CAS.pm | 1 - .../lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm | 1 - lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm | 1 - .../lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm | 1 - .../lib/Lemonldap/NG/Portal/Plugins/CrowdSec.pm | 1 - 9 files changed, 3 insertions(+), 10 deletions(-) diff --git a/lemonldap-ng-common/lib/Lemonldap/NG/Common/UserAgent.pm b/lemonldap-ng-common/lib/Lemonldap/NG/Common/UserAgent.pm index 25a3cf1ed6..e1d118e65f 100644 --- a/lemonldap-ng-common/lib/Lemonldap/NG/Common/UserAgent.pm +++ b/lemonldap-ng-common/lib/Lemonldap/NG/Common/UserAgent.pm @@ -7,11 +7,12 @@ use Lemonldap::NG::Common; our $VERSION = '2.18.0'; sub new { - my ( $class, $conf ) = @_; + my ( $class, $conf, $noproxy ) = @_; my $opts = $conf->{lwpOpts} || {}; my $agent = "LemonLDAP-NG/" . $Lemonldap::NG::Common::VERSION . " "; $opts->{agent} ||= $agent; - $opts->{ssl_opts} = $conf->{lwpSslOpts} if ( $conf->{lwpSslOpts} ); + $opts->{ssl_opts} = $conf->{lwpSslOpts} if ( $conf->{lwpSslOpts} ); + $opts->{env_proxy} = !$noproxy; my $ua = LWP::UserAgent->new(%$opts); push @{ $ua->requests_redirectable }, 'POST'; return $ua; diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GitHub.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GitHub.pm index 7b7ac149dd..6f7e416696 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GitHub.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/GitHub.pm @@ -22,7 +22,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/LinkedIn.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/LinkedIn.pm index 10bbaaa364..bc3ff64314 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/LinkedIn.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/LinkedIn.pm @@ -22,7 +22,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Twitter.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Twitter.pm index 72762e6494..a0a19be4c4 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Twitter.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Auth/Twitter.pm @@ -47,7 +47,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/CAS.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/CAS.pm index 496ef406b2..523c220776 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/CAS.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/CAS.pm @@ -21,7 +21,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm index ebc1913872..1e9fbdc00e 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/OpenIDConnect.pm @@ -101,7 +101,6 @@ has ua => ( lazy => 1, builder => sub { my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm index d6f099b619..7ffd498482 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Lib/SAML.pm @@ -46,7 +46,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm index 97ab1d7dc2..e285829322 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CheckDevOps.pm @@ -41,7 +41,6 @@ has ua => ( lazy => 1, builder => sub { my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); diff --git a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CrowdSec.pm b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CrowdSec.pm index 45efbfa206..cf856cb188 100644 --- a/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CrowdSec.pm +++ b/lemonldap-ng-portal/lib/Lemonldap/NG/Portal/Plugins/CrowdSec.pm @@ -24,7 +24,6 @@ has ua => ( # TODO : LWP options to use a proxy for example my $ua = Lemonldap::NG::Common::UserAgent->new( $_[0]->{conf} ); - $ua->env_proxy(); return $ua; } ); -- GitLab