Sha256: 311bf6b3263093ec31322cae0bf393543adf4f578b4d4cff0b035004896bc2db

Contents?: true

Size: 914 Bytes

Versions: 17

Compression:

Stored size: 914 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
module WWW
  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
end

Version data entries

17 entries across 17 versions & 5 rubygems

Version Path
eric-mechanize-0.9.3.20090623142847 lib/www/mechanize/monkey_patch.rb
knu-mechanize-0.9.3.20090623142847 lib/www/mechanize/monkey_patch.rb
tenderlove-mechanize-0.9.3.20090617085936 lib/www/mechanize/monkey_patch.rb
tenderlove-mechanize-0.9.3.20090623142847 lib/www/mechanize/monkey_patch.rb
mechanize-ntlm-0.9.1 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.0 lib/www/mechanize/monkey_patch.rb
mechanize-0.7.7 lib/www/mechanize/monkey_patch.rb
mechanize-0.7.8 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.3 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.1 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.2 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.4 lib/www/mechanize/monkey_patch.rb
mechanize-0.8.5 lib/www/mechanize/monkey_patch.rb
mechanize-0.9.0 lib/www/mechanize/monkey_patch.rb
mechanize-0.9.1 lib/www/mechanize/monkey_patch.rb
mechanize-0.9.3 lib/www/mechanize/monkey_patch.rb
mechanize-0.9.2 lib/www/mechanize/monkey_patch.rb