Skip to content
This repository has been archived by the owner on Sep 29, 2022. It is now read-only.

Commit

Permalink
Merge pull request #4 from fakenine/set_timeout_requests
Browse files Browse the repository at this point in the history
add read_timeout configuration for HTTP requests
  • Loading branch information
fwininger committed Feb 6, 2018
2 parents 667e2ef + d318990 commit 5429457
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
5 changes: 3 additions & 2 deletions README.md
Expand Up @@ -10,10 +10,11 @@ Communicate with Nessus Scanner (version 6+) over REST/JSON interface
```ruby
require 'nessus_rest'

n = NessusREST::Client.new (
n = NessusREST::Client.new(
url: 'https://localhost:8834',
username: 'user',
password: 'password')
password: 'password',
read_timeout: 30)
qs = n.scan_quick_template('basic','name-of-scan','localhost')
scanid = qs['scan']['id']
n.scan_wait4finish(scanid)
Expand Down
7 changes: 2 additions & 5 deletions lib/nessus_rest/http.rb
Expand Up @@ -17,11 +17,8 @@ def initialize(params = {})
uri = URI.parse(options[:url])
@connection = Net::HTTP.new(uri.host, uri.port)
@connection.use_ssl = options[:ssl_use]
@connection.verify_mode = if options[:ssl_verify]
OpenSSL::SSL::VERIFY_PEER
else
OpenSSL::SSL::VERIFY_NONE
end
@connection.verify_mode = options[:ssl_verify] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
@connection.read_timeout = options[:read_timeout] || @connection.read_timeout
end

def request(req)
Expand Down

0 comments on commit 5429457

Please sign in to comment.