Sha256: f109f6334ccd3fcda6686d1851df7b5b12f06a7605054e60b5e1e99160a41218

Contents?: true

Size: 909 Bytes

Versions: 5

Compression:

Stored size: 909 Bytes

Contents

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

Version data entries

5 entries across 5 versions & 4 rubygems

Version Path
kitamomonga-mechanize-0.9.3.20090724215219 lib/mechanize/monkey_patch.rb
tenderlove-mechanize-0.9.3.20090911221705 lib/mechanize/monkey_patch.rb
domo-0.0.4 vendor/bundle/ruby/1.9.1/gems/mechanize-1.0.0/lib/mechanize/monkey_patch.rb
mechanize-1.0.1.beta.20110107104205 lib/mechanize/monkey_patch.rb
mechanize-1.0.0 lib/mechanize/monkey_patch.rb