Module: OpenURI

Defined in:
lib/rhc/core_ext.rb

Overview

Allow http => https redirection, see bugs.ruby-lang.org/issues/859 to 1.8.7 for rough outline of change.

Class Method Summary collapse

Class Method Details

.redirectable?(uri1, uri2) ⇒ Boolean

:nodoc:

Returns:

  • (Boolean)


163
164
165
166
167
168
169
# File 'lib/rhc/core_ext.rb', line 163

def self.redirectable?(uri1, uri2) # :nodoc:
  # This test is intended to forbid a redirection from http://... to
  # file:///etc/passwd.
  # However this is ad hoc.  It should be extensible/configurable.
  uri1.scheme.downcase == uri2.scheme.downcase ||
  (/\A(?:http|ftp)\z/i =~ uri1.scheme && /\A(?:https?|ftp)\z/i =~ uri2.scheme)
end