This commit is contained in:
garnier-quentin 2015-07-29 15:02:59 +02:00
parent 821cc05608
commit a7050c1449
3 changed files with 16 additions and 2 deletions

View File

@ -47,6 +47,7 @@ sub new {
"proxyurl:s" => { name => 'proxyurl' },
"expected-string:s" => { name => 'expected_string' },
"timeout:s" => { name => 'timeout' },
"no-follow" => { name => 'no_follow', },
"ssl:s" => { name => 'ssl', },
"cert-file:s" => { name => 'cert_file' },
"key-file:s" => { name => 'key_file' },
@ -151,6 +152,10 @@ Specify password for basic authentification (Mandatory if --credentials is speci
Threshold for HTTP timeout (Default: 5)
=item B<--no-follow>
Do not follow http redirect
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)

View File

@ -49,6 +49,7 @@ sub new {
"warning:s" => { name => 'warning' },
"critical:s" => { name => 'critical' },
"timeout:s" => { name => 'timeout' },
"no-follow" => { name => 'no_follow', },
"ssl:s" => { name => 'ssl' },
"cert-file:s" => { name => 'cert_file' },
"key-file:s" => { name => 'key_file' },
@ -167,6 +168,10 @@ Proxy URL if any
Threshold for HTTP timeout (Default: 5)
=item B<--no-follow>
Do not follow http redirect
=item B<--ssl>
Specify SSL version (example : 'sslv3', 'tlsv1'...)

View File

@ -158,13 +158,17 @@ sub request {
$self->check_options(request => $request_options);
if (!defined($self->{ua})) {
$self->{ua} = LWP::UserAgent->new(keep_alive => 1, protocols_allowed => ['http', 'https'], timeout => $request_options->{timeout},
requests_redirectable => [ 'GET', 'HEAD', 'POST' ]);
$self->{ua} = LWP::UserAgent->new(keep_alive => 1, protocols_allowed => ['http', 'https'], timeout => $request_options->{timeout});
if (defined($request_options->{cookies_file})) {
$self->{ua}->cookie_jar(HTTP::Cookies->new(file => $request_options->{cookies_file},
autosave => 1));
}
}
if (defined($request_options->{no_follow})) {
$self->{ua}->requests_redirectable(undef);
} else {
$self->{ua}->requests_redirectable([ 'GET', 'HEAD', 'POST' ]);
}
if (defined($request_options->{http_peer_addr})) {
push @LWP::Protocol::http::EXTRA_SOCK_OPTS, PeerAddr => $request_options->{http_peer_addr};
}