diff options
-rw-r--r-- | ChangeLog | 5 | ||||
-rw-r--r-- | lib/uri/generic.rb | 1 | ||||
-rw-r--r-- | test/uri/test_generic.rb | 1 | ||||
-rw-r--r-- | version.h | 2 |
4 files changed, 8 insertions, 1 deletions
@@ -1,3 +1,8 @@ +Wed Jul 24 22:35:32 2013 NARUSE, Yui <naruse@ruby-lang.org> + + * lib/uri/generic.rb (find_proxy): raise BadURIError if the URI is + a relative URI. [Bug #8645] + Wed Jul 24 01:13:02 2013 CHIKANAGA Tomoyuki <nagachika@ruby-lang.org> * include/ruby/intern.h (rb_f_lambde): restore the declaration of diff --git a/lib/uri/generic.rb b/lib/uri/generic.rb index 1d8963af4d..387682b5b5 100644 --- a/lib/uri/generic.rb +++ b/lib/uri/generic.rb @@ -1611,6 +1611,7 @@ module URI # http_proxy is not used too if the variable is case insensitive. # CGI_HTTP_PROXY can be used instead. def find_proxy + raise BadURIError, "relative URI: #{self}" if self.relative? name = self.scheme.downcase + '_proxy' proxy_uri = nil if name == 'http_proxy' && ENV.include?('REQUEST_METHOD') # CGI? diff --git a/test/uri/test_generic.rb b/test/uri/test_generic.rb index 2d4603ca44..d22d3c1dd6 100644 --- a/test/uri/test_generic.rb +++ b/test/uri/test_generic.rb @@ -736,6 +736,7 @@ class URI::TestGeneric < Test::Unit::TestCase # 192.0.2.0/24 is TEST-NET. [RFC3330] def test_find_proxy + assert_raise(URI::BadURIError){ URI("foo").find_proxy } with_env({}) { assert_nil(URI("http://192.0.2.1/").find_proxy) assert_nil(URI("ftp://192.0.2.1/").find_proxy) @@ -1,6 +1,6 @@ #define RUBY_VERSION "2.0.0" #define RUBY_RELEASE_DATE "2013-07-24" -#define RUBY_PATCHLEVEL 278 +#define RUBY_PATCHLEVEL 279 #define RUBY_RELEASE_YEAR 2013 #define RUBY_RELEASE_MONTH 7 |