From a83f125c3141af17f0426d01e264d684fd60e317 Mon Sep 17 00:00:00 2001 From: naruse Date: Fri, 3 Jun 2011 00:32:25 +0000 Subject: * 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 --- ChangeLog | 13 +++++++++---- lib/uri/http.rb | 2 +- test/uri/test_http.rb | 1 + 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 64fb6ca91e..58f90576fe 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,7 +1,12 @@ +Fri Jun 3 09:27:31 2011 NARUSE, Yui + + * 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 - * 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 @@ -439,8 +444,8 @@ Mon May 23 09:45:26 2011 Hiroshi Nakamura Mon May 23 10:01:02 2011 Martin Bosslet * 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 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 -- cgit v1.2.3