Sha256: cb25b94757ac0d9cfc9c45362ff49ef48cc119fd83a6ed52d27521e91befbbb9

Contents?: true

Size: 970 Bytes

Versions: 6

Compression:

Stored size: 970 Bytes

Contents

if RUBY_VERSION < '1.9' then
  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
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

6 entries across 6 versions & 3 rubygems

Version Path
aai10-mechanize-2.0.1.0 lib/mechanize/monkey_patch.rb
neocoin-mechanize-2.0.2 lib/mechanize/monkey_patch.rb
mechanize-2.0.1 lib/mechanize/monkey_patch.rb
mechanize-2.0 lib/mechanize/monkey_patch.rb
mechanize-2.0.pre.2 lib/mechanize/monkey_patch.rb
mechanize-2.0.pre.1 lib/mechanize/monkey_patch.rb