* lib/open-uri.rb: Location: field may has a relative URI.

pointed out by erik eriksson <ee@opera.com>.


git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@3447 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
akr 2003-02-05 09:58:18 +00:00
parent b50100a769
commit 5504f490a6
2 changed files with 12 additions and 1 deletions

View File

@ -1,3 +1,8 @@
Wed Feb 5 18:54:54 2003 Tanaka Akira <akr@m17n.org>
* lib/open-uri.rb: Location: field may has a relative URI.
pointed out by erik eriksson <ee@opera.com>.
Wed Feb 5 17:11:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (yylex): no .<digit> floating literal anymore.

View File

@ -130,7 +130,13 @@ module OpenURI
uri.direct_open(buf, header)
end
rescue Redirect
uri = $!.uri
loc = $!.uri
if loc.relative?
# Although it violates RFC 2616, Location: field may have relative URI.
# It is converted to absolute URI using uri.
loc = uri + loc
end
uri = loc
raise "HTTP redirection loop: #{uri}" if uri_set.include? uri.to_s
uri_set[uri.to_s] = true
retry