Project

General

Profile

Feature #7396 ยป open-uri_location_header.patch

zzak (Zachary Scott), 11/19/2012 12:44 PM

View differences:

lib/open-uri.rb
Net::HTTPSeeOther, # 303
Net::HTTPTemporaryRedirect # 307
begin
loc_uri = URI.parse(resp['location'])
# Some bad formed sites responds location with unescaped special chars.
# Just a new URI.encode solve this.
loc_uri = URI.parse(URI.encode(resp['location']))
rescue URI::InvalidURIError
raise OpenURI::HTTPError.new(io.status.join(' ') + ' (Invalid Location URI)', io)
end
    (1-1/1)