zabbixapi 0.6.2 → 0.6.3

Sign up to get free protection for your applications and to get access to all the features.
@@ -49,9 +49,13 @@ class ZabbixApi
49
49
 
50
50
  def http_request(body)
51
51
  uri = URI.parse(@options[:url])
52
+ # set the time out the default (60) or to what the user passed
53
+ @options[:timeout] == nil ? timeout = 60 : timeout = @options[:timeout]
54
+ puts "[DEBUG] Timeout for request set to #{timeout} seconds" if @options[:debug]
52
55
 
53
56
  unless @proxy_uri.nil?
54
57
  http = Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
58
+
55
59
  if uri.port == 443
56
60
  http.use_ssl = true
57
61
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
@@ -63,6 +67,8 @@ class ZabbixApi
63
67
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE
64
68
  end
65
69
  end
70
+ http.read_timeout = timeout
71
+
66
72
  request = Net::HTTP::Post.new(uri.request_uri)
67
73
  request.basic_auth @options[:http_user], @options[:http_password] if @options[:http_user]
68
74
  request.add_field('Content-Type', 'application/json-rpc')
@@ -1,3 +1,3 @@
1
1
  class ZabbixApi
2
- VERSION = "0.6.2"
2
+ VERSION = "0.6.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: zabbixapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.6.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-17 00:00:00.000000000 Z
12
+ date: 2013-10-28 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: json