summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-03 00:32:25 +0000
committernaruse <naruse@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-03 00:32:25 +0000
commita83f125c3141af17f0426d01e264d684fd60e317 (patch)
treeaba91c95e4a7d888b25c34e61142a98f620b84d6
parentfe8002b17bb232b443a1dd6469318527db5b690e (diff)
* 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--ChangeLog13
-rw-r--r--lib/uri/http.rb2
-rw-r--r--test/uri/test_http.rb1
3 files changed, 11 insertions, 5 deletions
diff --git a/ChangeLog b/ChangeLog
index 64fb6ca91ed..58f90576fee 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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 3b108a48789..3b034057658 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 a323d43a79d..5d04e8cc6de 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