diff options
author | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-03 00:32:25 +0000 |
---|---|---|
committer | naruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2011-06-03 00:32:25 +0000 |
commit | a83f125c3141af17f0426d01e264d684fd60e317 (patch) | |
tree | aba91c95e4a7d888b25c34e61142a98f620b84d6 | |
parent | fe8002b17bb232b443a1dd6469318527db5b690e (diff) | |
download | ruby-a83f125c3141af17f0426d01e264d684fd60e317.tar.gz |
* lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri
is path-rootless form. Bug #4759
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31907 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r-- | ChangeLog | 13 | ||||
-rw-r--r-- | lib/uri/http.rb | 2 | ||||
-rw-r--r-- | test/uri/test_http.rb | 1 |
3 files changed, 11 insertions, 5 deletions
@@ -1,7 +1,12 @@ +Fri Jun 3 09:27:31 2011 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/net/http.rb (URI::HTTP#request_uri): return nil when the uri + is path-rootless form. Bug #4759 + Thu Jun 2 23:51:03 2011 James Edward Gray II <jeg2@ruby-lang.org> - * lib/csv.rb: Improve the line ending detection algorithm - (patch by Alexey). + * lib/csv.rb: Improve the line ending detection algorithm + patch by Alexey). Thu Jun 2 20:05:57 2011 NAKAMURA Usaku <usa@ruby-lang.org> @@ -439,8 +444,8 @@ Mon May 23 09:45:26 2011 Hiroshi Nakamura <nahi@ruby-lang.org> Mon May 23 10:01:02 2011 Martin Bosslet <Martin.Bosslet@googlemail.com> * ext/openssl/ossl_asn1.c: Do not parse zero-tagged values as EOC. Do - not let current length become negative for infinite length constructed - values. Support constructed values of length zero. Added tests. + not let current length become negative for infinite length constructed + values. Support constructed values of length zero. Added tests. Mon May 23 09:19:53 2011 Eric Hodel <drbrain@segment7.net> diff --git a/lib/uri/http.rb b/lib/uri/http.rb index 3b108a4878..3b03405765 100644 --- a/lib/uri/http.rb +++ b/lib/uri/http.rb @@ -94,7 +94,7 @@ module URI # def request_uri r = path_query - if r[0] != ?/ + if r && r[0] != ?/ r = '/' + r end diff --git a/test/uri/test_http.rb b/test/uri/test_http.rb index a323d43a79..5d04e8cc6d 100644 --- a/test/uri/test_http.rb +++ b/test/uri/test_http.rb @@ -47,6 +47,7 @@ class TestHTTP < Test::Unit::TestCase assert_equal('/?abc=def', URI.parse('http://a.b.c/?abc=def').request_uri) assert_equal('/', URI.parse('http://a.b.c').request_uri) assert_equal('/?abc=def', URI.parse('http://a.b.c?abc=def').request_uri) + assert_equal(nil, URI.parse('http:foo').request_uri) end def test_select |