| 1 |
package Lemonldap::NG::Common::UserAgent; |
| 2 |
|
| 3 |
use strict; |
| 4 |
use LWP::UserAgent; |
| 5 |
use Lemonldap::NG::Common; |
| 6 |
|
| 7 |
our $VERSION = '2.18.0'; |
| 8 |
|
| 9 |
sub new { |
| 10 |
my ( $class, $conf ) = @_; |
| 11 |
my $opts = $conf->{lwpOpts} || {}; |
| 12 |
my $agent = "LemonLDAP-NG/" . $Lemonldap::NG::Common::VERSION . " "; |
| 13 |
$opts->{agent} ||= $agent; |
| 14 |
$opts->{ssl_opts} = $conf->{lwpSslOpts} if ( $conf->{lwpSslOpts} ); |
| 15 |
my $ua = LWP::UserAgent->new(%$opts); |
| 16 |
push @{ $ua->requests_redirectable }, 'POST'; |
| 17 |
return $ua; |
| 18 |
} |
| 19 |
|
| 20 |
1; |