summaryrefslogtreecommitdiff
path: root/test/webrick/webrick.cgi
diff options
context:
space:
mode:
author(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-18 06:03:43 +0000
committer(no author) <(no author)@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2005-01-18 06:03:43 +0000
commit9f1945ac53f53bfbf4813f3ddda33cfb40e780c8 (patch)
tree1646b302a247a953a853b527e5c7b7489769ac46 /test/webrick/webrick.cgi
parentee61635f5a765ca5e5493a63bc838fa566539a57 (diff)
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@7783 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/webrick.cgi')
-rw-r--r--test/webrick/webrick.cgi26
1 files changed, 26 insertions, 0 deletions
diff --git a/test/webrick/webrick.cgi b/test/webrick/webrick.cgi
new file mode 100644
index 0000000000..97e1377454
--- /dev/null
+++ b/test/webrick/webrick.cgi
@@ -0,0 +1,26 @@
+#!ruby -d
+require "webrick/cgi"
+
+class TestApp < WEBrick::CGI
+ def do_GET(req, res)
+ res["content-type"] = "text/plain"
+ if p = req.path_info
+ res.body = p
+ elsif (q = req.query).size > 0
+ res.body = q.keys.sort.collect{|key|
+ q[key].list.sort.collect{|v|
+ "#{key}=#{v}"
+ }.join(", ")
+ }.join(", ")
+ else
+ res.body = req.script_name
+ end
+ end
+
+ def do_POST(req, res)
+ do_GET(req, res)
+ end
+end
+
+cgi = TestApp.new
+cgi.start