summaryrefslogtreecommitdiffstats
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
commit1b31bbe2c43ff8569d319d7c8663daabbb0cd029 (patch)
tree1646b302a247a953a853b527e5c7b7489769ac46 /test/webrick/webrick.cgi
parentf7d006e553ff5d1db2a5f0bbe3a0c39333949871 (diff)
downloadruby-1b31bbe2c43ff8569d319d7c8663daabbb0cd029.tar.gz
ruby-1b31bbe2c43ff8569d319d7c8663daabbb0cd029.tar.xz
ruby-1b31bbe2c43ff8569d319d7c8663daabbb0cd029.zip
This commit was manufactured by cvs2svn to create branch 'ruby_1_8'.
git-svn-id: http://svn.ruby-lang.org/repos/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 000000000..97e137745
--- /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