diff options
author | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-10 06:29:58 +0000 |
---|---|---|
committer | gotoyuzo <gotoyuzo@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2005-01-10 06:29:58 +0000 |
commit | 3286a9c39bb838ad4824e8809aa7af67aba07dea (patch) | |
tree | 77b4df3270c46d4eca271d09181e303b3da464d5 /test/webrick/webrick.cgi | |
parent | 77df5c7db4512928a60d9357894d84fb24a62269 (diff) | |
download | ruby-3286a9c39bb838ad4824e8809aa7af67aba07dea.tar.gz ruby-3286a9c39bb838ad4824e8809aa7af67aba07dea.tar.xz ruby-3286a9c39bb838ad4824e8809aa7af67aba07dea.zip |
* lib/webrick/cgi.rb (WEBrick::CGI::Socket#request_line): should
escape SCRIPT_NAME and PATH_INFO before being parsed as a URI.
* lib/webrick/httputils.rb (WEBrick::HTTPUtils#escape_path): add
new method to escape URI path component.
* lib/webrick/ssl.rb (WEBrick::Config::SSL): the default value
of :SSLEnable is false.
* test/webrick/{test_cgi.rb,webrick.cgi}: new file.
* test/webrick/utils.rb: require "webrick/https.h".
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@7758 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/webrick/webrick.cgi')
-rw-r--r-- | test/webrick/webrick.cgi | 26 |
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 |