lib/zabbixapi/client.rb in zabbixapi-0.5.1b10 vs lib/zabbixapi/client.rb in zabbixapi-0.5.1b11
- old
+ new
@@ -46,13 +46,13 @@
JSON.generate(message)
end
def http_request(body)
uri = URI.parse(@options[:url])
- unless @proxy_uri.nil?
- http = Net::HTTP.new(uri.host, uri.port)
- else
+ if @proxy_uri.nil?
http = Net::HTTP.Proxy(@proxy_host, @proxy_port, @proxy_user, @proxy_pass).new(uri.host, uri.port)
+ else
+ http = Net::HTTP.new(uri.host, uri.port)
end
request = Net::HTTP::Post.new(uri.request_uri)
request.basic_auth @options[:http_user], @options[:http_password] if @options[:http_user]
request.add_field('Content-Type', 'application/json-rpc')
request.body = body