+ fix #114
This commit is contained in:
parent
821cc05608
commit
a7050c1449
|
@ -47,6 +47,7 @@ sub new {
|
||||||
"proxyurl:s" => { name => 'proxyurl' },
|
"proxyurl:s" => { name => 'proxyurl' },
|
||||||
"expected-string:s" => { name => 'expected_string' },
|
"expected-string:s" => { name => 'expected_string' },
|
||||||
"timeout:s" => { name => 'timeout' },
|
"timeout:s" => { name => 'timeout' },
|
||||||
|
"no-follow" => { name => 'no_follow', },
|
||||||
"ssl:s" => { name => 'ssl', },
|
"ssl:s" => { name => 'ssl', },
|
||||||
"cert-file:s" => { name => 'cert_file' },
|
"cert-file:s" => { name => 'cert_file' },
|
||||||
"key-file:s" => { name => 'key_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)
|
Threshold for HTTP timeout (Default: 5)
|
||||||
|
|
||||||
|
=item B<--no-follow>
|
||||||
|
|
||||||
|
Do not follow http redirect
|
||||||
|
|
||||||
=item B<--ssl>
|
=item B<--ssl>
|
||||||
|
|
||||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||||
|
|
|
@ -49,6 +49,7 @@ sub new {
|
||||||
"warning:s" => { name => 'warning' },
|
"warning:s" => { name => 'warning' },
|
||||||
"critical:s" => { name => 'critical' },
|
"critical:s" => { name => 'critical' },
|
||||||
"timeout:s" => { name => 'timeout' },
|
"timeout:s" => { name => 'timeout' },
|
||||||
|
"no-follow" => { name => 'no_follow', },
|
||||||
"ssl:s" => { name => 'ssl' },
|
"ssl:s" => { name => 'ssl' },
|
||||||
"cert-file:s" => { name => 'cert_file' },
|
"cert-file:s" => { name => 'cert_file' },
|
||||||
"key-file:s" => { name => 'key_file' },
|
"key-file:s" => { name => 'key_file' },
|
||||||
|
@ -167,6 +168,10 @@ Proxy URL if any
|
||||||
|
|
||||||
Threshold for HTTP timeout (Default: 5)
|
Threshold for HTTP timeout (Default: 5)
|
||||||
|
|
||||||
|
=item B<--no-follow>
|
||||||
|
|
||||||
|
Do not follow http redirect
|
||||||
|
|
||||||
=item B<--ssl>
|
=item B<--ssl>
|
||||||
|
|
||||||
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
Specify SSL version (example : 'sslv3', 'tlsv1'...)
|
||||||
|
|
|
@ -158,13 +158,17 @@ sub request {
|
||||||
$self->check_options(request => $request_options);
|
$self->check_options(request => $request_options);
|
||||||
|
|
||||||
if (!defined($self->{ua})) {
|
if (!defined($self->{ua})) {
|
||||||
$self->{ua} = LWP::UserAgent->new(keep_alive => 1, protocols_allowed => ['http', 'https'], timeout => $request_options->{timeout},
|
$self->{ua} = LWP::UserAgent->new(keep_alive => 1, protocols_allowed => ['http', 'https'], timeout => $request_options->{timeout});
|
||||||
requests_redirectable => [ 'GET', 'HEAD', 'POST' ]);
|
|
||||||
if (defined($request_options->{cookies_file})) {
|
if (defined($request_options->{cookies_file})) {
|
||||||
$self->{ua}->cookie_jar(HTTP::Cookies->new(file => $request_options->{cookies_file},
|
$self->{ua}->cookie_jar(HTTP::Cookies->new(file => $request_options->{cookies_file},
|
||||||
autosave => 1));
|
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})) {
|
if (defined($request_options->{http_peer_addr})) {
|
||||||
push @LWP::Protocol::http::EXTRA_SOCK_OPTS, PeerAddr => $request_options->{http_peer_addr};
|
push @LWP::Protocol::http::EXTRA_SOCK_OPTS, PeerAddr => $request_options->{http_peer_addr};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue