Class: Net::HTTP

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

Instance Method Summary collapse

Instance Method Details

#keep_alive?(req, res) ⇒ Boolean

Returns:

  • (Boolean)


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

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



4
# File 'lib/mechanize/monkey_patch.rb', line 4

alias :old_keep_alive? :keep_alive?