def httpclient_for(options)
return @httpclient if @last_options == options
@httpclient = HTTPClient.new(:agent_name => user_agent).tap do |http|
http.cookie_manager = nil
http.debug_dev = $stderr if ENV['HTTP_DEBUG']
options.select{ |sym, value| http.respond_to?("#{sym}=") }.map{ |sym, value| http.send("#{sym}=", value) }
http.set_auth(nil, options[:user], options[:password]) if options[:user]
ssl = http.ssl_config
options.select{ |sym, value| ssl.respond_to?("#{sym}=") }.map{ |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