def set_http_connection_options(conn, opts)
      # Authentication
      unless uri.user.to_s.empty?
        conn.force_basic_auth = true
        conn.set_auth(uri.to_s, uri.user, uri.password)
      end

      # SSL Certificate option mapping
      if opts.include?(:verify_ssl)
        conn.ssl_config.verify_mode = opts[:verify_ssl] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
      end
      conn.ssl_config.client_cert = opts[:ssl_client_cert] if opts.include?(:ssl_client_cert)
      conn.ssl_config.client_key  = opts[:ssl_client_key]  if opts.include?(:ssl_client_key)
      conn.ssl_config.set_trust_ca(opts[:ssl_ca_file]) if opts.include?(:ssl_ca_file)

      # Timeout options
      conn.receive_timeout = opts[:timeout] if opts.include?(:timeout)
      conn.connect_timeout = opts[:open_timeout] if opts.include?(:open_timeout)
      conn.send_timeout    = opts[:read_timeout] if opts.include?(:read_timeout)
    end
def set_http_connection_options(conn, opts)
      # Authentication
      unless uri.user.to_s.empty?
        conn.force_basic_auth = true
        conn.set_auth(uri.to_s, uri.user, uri.password)
      end

      # SSL Certificate option mapping
      if opts.include?(:verify_ssl)
        conn.ssl_config.verify_mode = opts[:verify_ssl] ? OpenSSL::SSL::VERIFY_PEER : OpenSSL::SSL::VERIFY_NONE
      end
      conn.ssl_config.client_cert = opts[:ssl_client_cert] if opts.include?(:ssl_client_cert)
      conn.ssl_config.client_key  = opts[:ssl_client_key]  if opts.include?(:ssl_client_key)
      conn.ssl_config.set_trust_ca(opts[:ssl_ca_file]) if opts.include?(:ssl_ca_file)

      # Timeout options
      conn.receive_timeout = opts[:timeout] if opts.include?(:timeout)
      conn.connect_timeout = opts[:open_timeout] if opts.include?(:open_timeout)
      conn.send_timeout    = opts[:read_timeout] if opts.include?(:read_timeout)
    end
Prepare the http connection options for HTTPClient.
 We try to maintain RestClient compatability in option names as this is what we used before.