Class: Net::HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/www/mechanize/monkey_patch.rb

Instance Method Summary collapse

Instance Method Details

#keep_alive?(req, res) ⇒ Boolean

Returns:

  • (Boolean)


4
5
6
7
8
9
10
11
12
# File 'lib/www/mechanize/monkey_patch.rb', line 4

def keep_alive?(req, res)
  return false if /close/i =~ req['connection'].to_s
  return false if @seems_1_0_server
  return false if /close/i      =~ res['connection'].to_s
  return true  if /keep-alive/i =~ res['connection'].to_s
  return false if /close/i      =~ res['proxy-connection'].to_s
  return true  if /keep-alive/i =~ res['proxy-connection'].to_s
  (@curr_http_version == '1.1')
end

#old_keep_alive?Object



3
# File 'lib/www/mechanize/monkey_patch.rb', line 3

alias :old_keep_alive? :keep_alive?