lib/splunk_client/splunk_client.rb in splunk-client-0.9.0 vs lib/splunk_client/splunk_client.rb in splunk-client-0.10.0
- old
+ new
@@ -10,12 +10,12 @@
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_alert')
require File.expand_path File.join(File.dirname(__FILE__), 'splunk_alert_feed')
class SplunkClient
- def initialize(username, password, host, port=8089, proxy_url = '')
- @USER=username; @PASS=password; @HOST=host; @PORT=port
+ def initialize(username, password, host, port=8089, proxy_url = '', read_time_out=60, use_ssl=true)
+ @USER=username; @PASS=password; @HOST=host; @PORT=port; @SSL=use_ssl; @READ_TIMEOUT = read_time_out
@PROXY_URI = URI(proxy_url) if proxy_url && !proxy_url.empty?
sessionKey = get_session_key
if (sessionKey == "")
@@ -75,10 +75,11 @@
if @PROXY_URI
http = Net::HTTP.new(@HOST, @PORT, @PROXY_URI.host, @PROXY_URI.port)
else
http = Net::HTTP.new(@HOST, @PORT)
end
- http.use_ssl = true
+ http.read_timeout = @READ_TIMEOUT
+ http.use_ssl = @SSL
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
return http
end
def splunk_get_request(path)