* 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
This commit is contained in:
naruse 2011-06-03 00:32:25 +00:00
parent fe8002b17b
commit a83f125c31
3 changed files with 11 additions and 5 deletions

View File

@ -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> Thu Jun 2 23:51:03 2011 James Edward Gray II <jeg2@ruby-lang.org>
* lib/csv.rb: Improve the line ending detection algorithm * lib/csv.rb: Improve the line ending detection algorithm
(patch by Alexey). patch by Alexey).
Thu Jun 2 20:05:57 2011 NAKAMURA Usaku <usa@ruby-lang.org> Thu Jun 2 20:05:57 2011 NAKAMURA Usaku <usa@ruby-lang.org>

View File

@ -94,7 +94,7 @@ module URI
# #
def request_uri def request_uri
r = path_query r = path_query
if r[0] != ?/ if r && r[0] != ?/
r = '/' + r r = '/' + r
end end

View File

@ -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('/?abc=def', URI.parse('http://a.b.c/?abc=def').request_uri)
assert_equal('/', URI.parse('http://a.b.c').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('/?abc=def', URI.parse('http://a.b.c?abc=def').request_uri)
assert_equal(nil, URI.parse('http:foo').request_uri)
end end
def test_select def test_select