dhruvbansal / rubix

A Ruby client for configuring and writing to Zabbix
Other
25 stars 12 forks source link

SSL Support #3

Closed unilogic closed 12 years ago

unilogic commented 12 years ago

Rubix doesn't appear to support SSL, at least in my test environment 1.9.1_p431. The follow change adds support:

diff --git a/lib/rubix/connection.rb b/lib/rubix/connection.rb
index 2748141..6a79b58 100644
--- a/lib/rubix/connection.rb
+++ b/lib/rubix/connection.rb
@@ -1,6 +1,7 @@
 require 'uri'
 require 'cgi'
 require 'net/http'
+require 'net/https'
 require 'json'

 require 'rubix/log'
@@ -127,6 +128,10 @@ module Rubix
         @uri = URI.parse(string)
       end
       @server = Net::HTTP.new(uri.host, uri.port)
+      if @uri.scheme == 'https' 
+        @server.use_ssl = true
+      end
+      return @server
     end

     protected
dhruvbansal commented 12 years ago

Closed, as fixed by https://github.com/dhruvbansal/rubix/pull/4