Project

General

Profile

Feature #9987

Updated by nobu (Nobuyoshi Nakada) over 10 years ago

~~~ruby 
     def `def HTTP.start(address, *arg, &block) # :yield: +http+ 
       arg.pop if opt = Hash.try_convert(arg[-1]) 
       port, p_addr, p_port, p_user, p_pass = *arg 
       port = https_default_port if !port && opt && opt[:use_ssl] 
       http = new(address, port, p_addr, p_port, p_user, p_pass) 

       if opt 
         if opt[:use_ssl] 
           opt = {verify_mode: OpenSSL::SSL::VERIFY_PEER}.update(opt) 
         end 
         http.methods.grep(/\A(\w+)=\z/) do |meth| 
           key = $1.to_sym 
           opt.key?(key) or next 
           http.__send__(meth, opt[key]) 
         end 
       end 

       http.start(&block) 
     end 
 ~~~ end` 

 method 'methods' in http(Net::HTTP) private when running in rake task.

Back