summaryrefslogtreecommitdiff
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
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
-rw-r--r--ChangeLog7
-rw-r--r--lib/webrick/httpservlet/cgihandler.rb4
2 files changed, 11 insertions, 0 deletions
diff --git a/ChangeLog b/ChangeLog
index 6dcd5765f1..0101772944 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+Wed May 28 16:12:44 2008 Akinori MUSHA <knu@iDaemons.org>
+
+ * 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.
+
Wed May 28 15:18:16 2008 Nobuyoshi Nakada <nobu@ruby-lang.org>
* lib/singleton.rb (SingletonClassMethods): _load should be public.
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)