From a7a09ce2730265932908d20ed8be5446889cc239 Mon Sep 17 00:00:00 2001 From: knu Date: Wed, 28 May 2008 07:15:52 +0000 Subject: * lib/webrick/httpservlet/cgihandler.rb (WEBrick::HTTPServlet::CGIHandler#do_GET): Set the HTTP status code to 302 if a Location header field is present and the status code is not valid as a client redirection. cf. RFC 3875 6.2.3, 6.2.4. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@16663 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- lib/webrick/httpservlet/cgihandler.rb | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/webrick/httpservlet') diff --git a/lib/webrick/httpservlet/cgihandler.rb b/lib/webrick/httpservlet/cgihandler.rb index a35b59edb8..d5895e5285 100644 --- a/lib/webrick/httpservlet/cgihandler.rb +++ b/lib/webrick/httpservlet/cgihandler.rb @@ -85,6 +85,10 @@ module WEBrick res.status = $1.to_i header.delete('status') end + if header.has_key?('location') + # RFC 3875 6.2.3, 6.2.4 + res.status = 302 unless (300...400) === res.status + end if header.has_key?('set-cookie') header['set-cookie'].each{|k| res.cookies << Cookie.parse_set_cookie(k) -- cgit v1.2.3