change cookie handling for velocloud

This commit is contained in:
Colin Gagnaire 2019-06-19 11:11:54 +02:00
parent 594a162825
commit c127ffcbb0
1 changed files with 8 additions and 5 deletions

View File

@ -157,11 +157,14 @@ sub get_session_cookie {
url_path => $self->{api_path} . $login_url,
query_form_post => $encoded
);
my ($cookie) = $self->{http}->get_header(name => 'Set-Cookie');
$cookie =~ /velocloud.message=(.*);/
my $message = $1;
$cookie =~ /velocloud.session=(.*);/
my $session = $1;
my ($cookies) = $self->{http}->get_header(name => 'Set-Cookie');
my $message = '';
my $session = '';
foreach my $cookie (@{$cookies}) {
$message = $1 if ($cookie =~ /velocloud.message=(.*);/);
$session = $1 if ($cookie =~ /velocloud.session=(.*);/);
}
if (!defined($session)) {
$self->{output}->add_option_msg(short_msg => "Cannot get session cookie: " . $message);