# File lib/mechanize/chain/response_header_handler.rb, line 11 11: def handle(ctx, params) 12: response = params[:response] 13: uri = params[:uri] 14: page = params[:page] 15: cache_obj = (@connection_cache["#{uri.host}:#{uri.port}"] ||= { 16: :connection => nil, 17: :keep_alive_options => {}, 18: }) 19: 20: # If the server sends back keep alive options, save them 21: if keep_alive_info = response['keep-alive'] 22: keep_alive_info.split(/,\s*/).each do |option| 23: k, v = option.split(/\=/) 24: cache_obj[:keep_alive_options] ||= {} 25: cache_obj[:keep_alive_options][k.intern] = v 26: end 27: end 28: 29: if page.is_a?(Page) && page.body =~ /Set-Cookie/ 30: page.search('//head/meta[@http-equiv="Set-Cookie"]').each do |meta| 31: Cookie::parse(uri, meta['content']) { |c| 32: Mechanize.log.debug("saved cookie: #{c}") if Mechanize.log 33: @cookie_jar.add(uri, c) 34: } 35: end 36: end 37: 38: (response.get_fields('Set-Cookie')||[]).each do |cookie| 39: Cookie::parse(uri, cookie) { |c| 40: Mechanize.log.debug("saved cookie: #{c}") if Mechanize.log 41: @cookie_jar.add(uri, c) 42: } 43: end 44: super 45: end
Disabled; run with --debug to generate this.
Generated with the Darkfish Rdoc Generator 1.1.6.