Fix httplib problems
This commit is contained in:
parent
d5c7f888f2
commit
c479448c2c
|
@ -144,6 +144,7 @@ sub check_options {
|
|||
}
|
||||
}
|
||||
}
|
||||
$self->{headers}->{SOAPAction} = $self->{option_results}->{service_soap};
|
||||
}
|
||||
|
||||
sub load_request {
|
||||
|
|
|
@ -82,21 +82,31 @@ sub connect {
|
|||
}
|
||||
$req = HTTP::Request->new($method => $uri);
|
||||
|
||||
if ($method eq 'POST') {
|
||||
my $uri_post = URI->new();
|
||||
if (defined($options{query_form_post})) {
|
||||
$uri->query_form($options{query_form_post});
|
||||
}
|
||||
$req->content_type('application/x-www-form-urlencoded');
|
||||
$req->content($uri_post->query);
|
||||
}
|
||||
|
||||
my $content_type_forced;
|
||||
if (defined($options{headers})) {
|
||||
foreach my $key (keys %{$options{headers}}) {
|
||||
$req->header($key => $options{headers}->{$key});
|
||||
if ($key !~ /content-type/i) {
|
||||
$req->header($key => $options{headers}->{$key});
|
||||
} else {
|
||||
$content_type_forced = $options{headers}->{$key};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($method eq 'POST') {
|
||||
if (defined($content_type_forced)) {
|
||||
$req->content_type($content_type_forced);
|
||||
$req->content($options{query_form_post});
|
||||
} else {
|
||||
my $uri_post = URI->new();
|
||||
if (defined($options{query_form_post})) {
|
||||
$uri_post->query_form($options{query_form_post});
|
||||
}
|
||||
$req->content_type('application/x-www-form-urlencoded');
|
||||
$req->content($uri_post->query);
|
||||
}
|
||||
}
|
||||
|
||||
if (defined($self->{option_results}->{credentials}) && defined($self->{option_results}->{ntlm})) {
|
||||
$ua->credentials($self->{option_results}->{hostname} . ':' . $self->{option_results}->{port}, '', $self->{option_results}->{username}, $self->{option_results}->{password});
|
||||
} elsif (defined($self->{option_results}->{credentials})) {
|
||||
|
|
Loading…
Reference in New Issue