1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* 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> Wed Feb 5 17:11:02 2003 Yukihiro Matsumoto <matz@ruby-lang.org>
* parse.y (yylex): no .<digit> floating literal anymore. * parse.y (yylex): no .<digit> floating literal anymore.

View file

@ -130,7 +130,13 @@ module OpenURI
uri.direct_open(buf, header) uri.direct_open(buf, header)
end end
rescue Redirect 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 raise "HTTP redirection loop: #{uri}" if uri_set.include? uri.to_s
uri_set[uri.to_s] = true uri_set[uri.to_s] = true
retry retry