fix timeout issue (#2316)
This commit is contained in:
parent
1d215a9f89
commit
ef0d016576
|
@ -76,7 +76,7 @@ sub check_options {
|
|||
$self->{port} = (defined($self->{option_results}->{port})) ? $self->{option_results}->{port} : 80;
|
||||
$self->{proto} = (defined($self->{option_results}->{proto})) ? $self->{option_results}->{proto} : 'http';
|
||||
$self->{url_path} = (defined($self->{option_results}->{url_path})) ? $self->{option_results}->{url_path} : '/v0/';
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout})) ? $self->{option_results}->{timeout} : 10;
|
||||
$self->{timeout} = (defined($self->{option_results}->{timeout}) && $self->{option_results}->{timeout} =~ /^(\d+)$/) ? $1 : 30;
|
||||
$self->{api_username} = (defined($self->{option_results}->{api_username})) ? $self->{option_results}->{api_username} : undef;
|
||||
$self->{api_password} = (defined($self->{option_results}->{api_password})) ? $self->{option_results}->{api_password} : undef;
|
||||
$self->{unknown_http_status} = (defined($self->{option_results}->{unknown_http_status})) ? $self->{option_results}->{unknown_status} : '%{http_code} < 200 or %{http_code} >= 300';
|
||||
|
|
|
@ -301,7 +301,7 @@ sub request {
|
|||
$self->curl_setopt(option => $self->{constant_cb}->(name => 'CURLOPT_VERBOSE'), parameter => 1);
|
||||
}
|
||||
|
||||
if (defined($options{request}->{timeout})) {
|
||||
if (defined($options{request}->{timeout}) && $options{request}->{timeout} =~ /\d/) {
|
||||
$self->curl_setopt(option => $self->{constant_cb}->(name => 'CURLOPT_TIMEOUT'), parameter => $options{request}->{timeout});
|
||||
}
|
||||
if (defined($options{request}->{cookies_file})) {
|
||||
|
|
Loading…
Reference in New Issue