def self.http_post(http, url, json_data, password)
req = http::Post.new(url.path)
req.set_form_data({'json_data' => json_data, 'password' => password})
http = http.new(url.host, url.port)
http.open_timeout = 10
if url.scheme == "https"
http.use_ssl = true
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
end
begin
response = http.start {|http| http.request(req)}
if response.code == '404' && response.content_type == 'text/html'
puts "!!!! WARNING !!!! WARNING !!!! WARNING !!!!"
puts "RHCloud server not found. You might want to try updating your rhc client tools."
exit 218
end
response
rescue Exception => e
puts "There was a problem communicating with the server. Response message: #{e.message}"
puts "If you were disconnected it is possible the operation finished without being able to report success."
puts "You can use rhc-user-info and rhc-ctl-app to learn about the status of your user and application(s)."
exit 219
end
end