summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-28 07:15:52 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2008-05-28 07:15:52 +0000
commita7a09ce2730265932908d20ed8be5446889cc239 (patch)
tree77c3cb9dd55f1e3f275a93e7f5c8ad303f1e215e /lib
parent4f4ab5e23055ced699eac64ea2d21ed5f8a1fca3 (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb4
1 files changed, 4 insertions, 0 deletions
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)