ruby-changes:10601
From: knu <ko1@a...>
Date: Mon, 9 Feb 2009 12:16:59 +0900 (JST)
Subject: [ruby-changes:10601] Ruby:r22158 (ruby_1_8): r22165@crimson: knu | 2009-02-09 11:55:30 +0900
knu 2009-02-09 12:16:49 +0900 (Mon, 09 Feb 2009) New Revision: 22158 http://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=rev&revision=22158 Log: r22165@crimson: knu | 2009-02-09 11:55:30 +0900 (OpenURI.open_http): rescue URI::InvalidURIError by URI.parse for location URI. (r15406) Modified directories: branches/ruby_1_8/ Modified files: branches/ruby_1_8/ChangeLog branches/ruby_1_8/lib/open-uri.rb Index: ruby_1_8/ChangeLog =================================================================== --- ruby_1_8/ChangeLog (revision 22157) +++ ruby_1_8/ChangeLog (revision 22158) @@ -17,6 +17,8 @@ (OpenURI::Buffer): use Meta ===. [ruby-core:14295] (r14609) (OpenURI::Meta#content_type_parse): fix tests. [ruby-dev:33336] (r15200) + (OpenURI.open_http): rescue URI::InvalidURIError by URI.parse + for location URI. (r15406) Mon Feb 9 01:21:16 2009 Tanaka Akira <akr@f...> Index: ruby_1_8/lib/open-uri.rb =================================================================== --- ruby_1_8/lib/open-uri.rb (revision 22157) +++ ruby_1_8/lib/open-uri.rb (revision 22158) @@ -327,7 +327,12 @@ Net::HTTPFound, # 302 Net::HTTPSeeOther, # 303 Net::HTTPTemporaryRedirect # 307 - throw :open_uri_redirect, URI.parse(resp['location']) + begin + loc_uri = URI.parse(resp['location']) + rescue URI::InvalidURIError + raise OpenURI::HTTPError.new(io.status.join(' ') + ' (Invalid Location URI)', io) + end + throw :open_uri_redirect, loc_uri else raise OpenURI::HTTPError.new(io.status.join(' '), io) end Property changes on: ruby_1_8 ___________________________________________________________________ Name: svk:merge - 050cfa88-b445-4b2e-b226-957b86f2c464:/local/ruby/1.8:22164 b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk:5286 + 050cfa88-b445-4b2e-b226-957b86f2c464:/local/ruby/1.8:22165 b2dd03c8-39d4-4d8f-98ff-823fe69b080e:/trunk:5286 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/