/usr/lib/ruby/1.8/mechanize/monkey_patch.rb is in libwww-mechanize-ruby1.8 1.0.0-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | module Net
class HTTP
alias :old_keep_alive? :keep_alive?
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
end
end
# Monkey patch for ruby 1.8.4
unless RUBY_VERSION > "1.8.4"
module Net # :nodoc:
class HTTPResponse # :nodoc:
CODE_TO_OBJ['500'] = HTTPInternalServerError
end
end
else
class Mechanize
class Form
alias :inspect :pretty_inspect
end
class Page
alias :inspect :pretty_inspect
class Link
alias :inspect :pretty_inspect
end
end
end
end
|