Permalink
Browse files

Handle HTTPS protocol

  • Loading branch information...
1 parent 8024948 commit 0c56d276907befe8cb478ec4e6ece6a7e082f377 @chirag-jog chirag-jog committed Aug 28, 2012
Showing with 7 additions and 3 deletions.
  1. +7 −3 lib/knife-cloudstack/connection.rb
View
10 lib/knife-cloudstack/connection.rb
@@ -547,9 +547,13 @@ def send_request(params)
signature = CGI.escape(signature)
url = "#{@api_url}?#{data}&signature=#{signature}"
-
- response = Net::HTTP.get_response(URI.parse(url))
-
+ uri = URI.parse(url)
+ http = Net::HTTP.new(uri.host, uri.port)
+ http.use_ssl = true
+ http.verify_mode = OpenSSL::SSL::VERIFY_NONE
+ request = Net::HTTP::Get.new(uri.request_uri)
+ response = http.request(request)
+
if !response.is_a?(Net::HTTPOK) then
puts "Error #{response.code}: #{response.message}"
puts JSON.pretty_generate(JSON.parse(response.body))

0 comments on commit 0c56d27

Please sign in to comment.