def self.http
uri = URI.parse(::PulpProxy::Plugin.settings.pulp_url.to_s)
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = uri.scheme == 'https'
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
if http.use_ssl?
if Proxy::SETTINGS.ssl_ca_file && !Proxy::SETTINGS.ssl_ca_file.to_s.empty?
http.ca_file = Proxy::SETTINGS.ssl_ca_file
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
end
if Proxy::SETTINGS.ssl_certificate && !Proxy::SETTINGS.ssl_certificate.to_s.empty? && Proxy::SETTINGS.ssl_private_key && !Proxy::SETTINGS.ssl_private_key.to_s.empty?
http.cert = OpenSSL::X509::Certificate.new(File.read(Proxy::SETTINGS.ssl_certificate))
http.key = OpenSSL::PKey::RSA.new(File.read(Proxy::SETTINGS.ssl_private_key), nil)
end
end
http
end