Subject: | allow_https does not work as expected |
Date: | Tue, 28 May 2013 12:08:52 +0200 |
To: | bug-API-DirectAdmin [...] rt.cpan.org |
From: | Sebastiaan Hoogeveen <zebaz [...] xs4all.nl> |
Even when API::DirectAdmin is initialised with allow_https => 0 the module forces the use of HTTPS. This does not work on installations where HTTPS is simply not enabled. I would propose to change the following line in the API::DirectAdmin::mk_full_query_string method:
$self->{allow_https} = ( defined $params->{allow_https} && $params->{allow_https} == 0 ) ? 0 : 1;
to:
$self->{allow_https} = $params->{allow_https} if ( defined $params->{allow_https} );
Or remove the setting of $self->{allow_https} altogether (it could be confusing to change object configuration based on a parameter specified in some call) and instead use a local $allow_https variable which is set like this:
my $allow_https = defined $params->{allow_https} ? $params->{allow_https} : $self->{allow_https};
delete $params->{allow_https}
And then do:
my $query_path = ( $allow_https ? 'https' : 'http' ) . "://$auth_user:$auth_passwd\@$host:$port/$command?";