# File lib/rhc/rest/client.rb, line 526
        def httpclient_for(options, auth=nil)
          user, password, token = options.delete(:user), options.delete(:password), options.delete(:token)

          if !@httpclient || @last_options != options
            @httpclient = RHC::Rest::HTTPClient.new(:agent_name => user_agent).tap do |http|
              debug "Created new httpclient"
              http.cookie_manager = nil
              http.debug_dev = $stderr if ENV['HTTP_DEBUG']

              options.select{ |sym, value| http.respond_to?("#{sym}=") }.each{ |sym, value| http.send("#{sym}=", value) }

              ssl = http.ssl_config
              options.select{ |sym, value| ssl.respond_to?("#{sym}=") }.each{ |sym, value| ssl.send("#{sym}=", value) }
              ssl.add_trust_ca(options[:ca_file]) if options[:ca_file]
              ssl.verify_callback = default_verify_callback

              @last_options = options
            end
          end
          if auth && auth.respond_to?(:to_httpclient)
            auth.to_httpclient(@httpclient, options)
          else
            @httpclient.www_auth.basic_auth.set(@end_point, user, password) if user
            @httpclient.www_auth.oauth2.set_token(@end_point, token) if token
          end
          @httpclient
        end