Skip to content

Commit

Permalink
Use default if timeout is nil
Browse files Browse the repository at this point in the history
With the current implementation the default timeout is never used
because a timeout argument is always passed to api_verification.
  • Loading branch information
maalur committed Oct 1, 2019
1 parent f93ddb4 commit d2e1746
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/recaptcha.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ def self.verify_via_api_call(response, options)
verify_hash = { 'secret' => secret_key, 'response' => response }
verify_hash['remoteip'] = options[:remote_ip] if options.key?(:remote_ip)

reply = api_verification(verify_hash, timeout: options[:timeout])
reply = api_verification(verify_hash, options[:timeout])
reply['success'].to_s == 'true' &&
hostname_valid?(reply['hostname'], options[:hostname]) &&
action_valid?(reply['action'], options[:action]) &&
Expand Down Expand Up @@ -99,7 +99,8 @@ def self.score_above_threshold?(score, minimum_score)
end
end

def self.api_verification(verify_hash, timeout: DEFAULT_TIMEOUT)
def self.api_verification(verify_hash, timeout)
timeout ||= DEFAULT_TIMEOUT
http = if configuration.proxy
proxy_server = URI.parse(configuration.proxy)
Net::HTTP::Proxy(proxy_server.host, proxy_server.port, proxy_server.user, proxy_server.password)
Expand Down

0 comments on commit d2e1746

Please sign in to comment.