public
Description: CGIAlt is a re-implementation of cgi.rb
Homepage: http://cgialt.rubyforge.org/
Clone URL: git://github.com/kwatch/cgialt.git
cgialt / bench.fcgi
100755 27 lines (22 sloc) 0.589 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/local/bin/ruby
 
##
## example:
## $ ab -n 20000 -c 5 'http://localhost:80/bench.fcgi?name=%40%21%7C+%2A%3F'
##
 
 
#require 'cgi'; require 'fcgi'
require 'cgialt'; require 'cgialt/fcgi'
#require 'cgiext'
 
FCGI.each_cgi do |cgi|
  #begin
    name = cgi['name']
    name = 'World' if name.empty?
    print cgi.header('text/html')
    print "<html><body><h1>Hello #{CGI.escapeHTML(name)}</h1></body></html>\n"
  #rescue Exception => ex
  # print cgi.header('text/plain')
  # puts "*** ERROR: #{ex}"
  # ex.backtrace.each do |item|
  # puts " from #{item}"
  # end
  #end
end