summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-11 22:11:07 +0000
committerdrbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-04-11 22:11:07 +0000
commit655738577ffd90df3796c73afd8be84cd89091f6 (patch)
tree596aa53f8c7b6569337911f0cf22b1e43a723193
parentea9b6997cc8bcb70ea82cb0535d1a4b5a5fd5508 (diff)
* 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 git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@35305 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--ChangeLog6
-rw-r--r--lib/uri/generic.rb2
-rw-r--r--test/uri/test_generic.rb6
3 files changed, 13 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index 2d05296..b423ce3 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 1056cfe..2c453dc 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 2c9bdd0..e0ab049 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)