set content-legth to 0 for vmware vcsa

This commit is contained in:
garnier-quentin 2019-09-03 09:21:41 +02:00
parent b842ec970e
commit f8d7de7ce3
3 changed files with 18 additions and 10 deletions

View File

@ -173,7 +173,8 @@ sub authenticate {
credentials => 1, basic => 1,
username => $self->{api_username},
password => $self->{api_password},
warning_status => '', unknown_status => '', critical_status => ''
warning_status => '', unknown_status => '', critical_status => '',
curl_backend_options => { header => ['Content-Length: 0'] },
);
if ($self->{http}->get_code() != 200) {
$self->{output}->add_option_msg(short_msg => "Login error [code: '" . $self->{http}->get_code() . "'] [message: '" . $self->{http}->get_message() . "']");

View File

@ -30,10 +30,10 @@ sub new {
if (!defined($options{noptions}) || $options{noptions} != 1) {
$options{options}->add_options(arguments => {
"http-peer-addr:s" => { name => 'http_peer_addr' },
"proxyurl:s" => { name => 'proxyurl' },
"proxypac:s" => { name => 'proxypac' },
"http-backend:s" => { name => 'http_backend', default => 'lwp' },
'http-peer-addr:s' => { name => 'http_peer_addr' },
'proxyurl:s' => { name => 'proxyurl' },
'proxypac:s' => { name => 'proxypac' },
'http-backend:s' => { name => 'http_backend', default => 'lwp' },
});
$options{options}->add_help(package => __PACKAGE__, sections => 'HTTP GLOBAL OPTIONS');
}
@ -87,6 +87,13 @@ sub check_options {
$self->{output}->option_exit();
}
if (defined($options{request}->{curl_backend_options}) &&
$self->{http_backend} eq 'curl') {
foreach (keys %{$options{request}->{curl_backend_options}}) {
$options{request}->{$_} = $options{request}->{curl_backend_options}->{$_};
}
}
if (($options{request}->{proto} ne 'http') && ($options{request}->{proto} ne 'https')) {
$self->{output}->add_option_msg(short_msg => "Unsupported protocol specified '" . $self->{option_results}->{proto} . "'.");
$self->{output}->option_exit();