diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | lib/uri/generic.rb | 2 | ||||
-rw-r--r-- | test/uri/test_generic.rb | 6 |
3 files changed, 13 insertions, 1 deletions
@@ -1,3 +1,9 @@ +Thu Apr 12 07:10:37 2012 Eric Hodel <drbrain@segment7.net> + + * lib/uri/generic.rb (module URI): URI now downcases the scheme to + follow RFC 2396 section 3.1. [ruby-trunk - Feature #4551] + * test/uri/test_generic.rb (class URI): Test for above + Thu Apr 12 06:15:44 2012 Eric Hodel <drbrain@segment7.net> * lib/net/protocol.rb (module Net): Added ReadTimeout to match diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 1056cfe3bc..2c453dc9db 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -339,7 +339,7 @@ module URI # see also URI::Generic.scheme= # def set_scheme(v) - @scheme = v + @scheme = v ? v.downcase : v end protected :set_scheme diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index 2c9bdd00fa..e0ab049122 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -708,6 +708,12 @@ class URI::TestGeneric < Test::Unit::TestCase assert_raise(URI::InvalidURIError) { uri.query = 'bar' } end + def test_set_scheme + uri = URI.parse 'HTTP://example' + + assert_equal 'http://example', uri.to_s + end + def test_ipv6 assert_equal("[::1]", URI("http://[::1]/bar/baz").host) assert_equal("::1", URI("http://[::1]/bar/baz").hostname) |