<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array">
    <added>
      <filename>CHANGES.txt</filename>
    </added>
    <added>
      <filename>bench.fcgi</filename>
    </added>
    <added>
      <filename>fcgi.README</filename>
    </added>
    <added>
      <filename>fcgi.README.signals</filename>
    </added>
    <added>
      <filename>fcgi.rb</filename>
    </added>
    <added>
      <filename>lib/cgialt/fcgi.rb</filename>
    </added>
    <added>
      <filename>lib/cgialt/fcgi/cgi_helper.rb</filename>
    </added>
    <added>
      <filename>lib/cgialt/fcgi/core.rb</filename>
    </added>
  </added>
  <modified type="array">
    <modified>
      <diff>@@ -1,9 +1,11 @@
 = README.txt
 
-Release: 0.0.1
+Release: 0.0.2
 
 copyright(c) 2007 kuwata-lab.com all rights reserved.
 
+http://rubyforge.org/projects/cgialt/
+
 
 ==  About
 
@@ -17,14 +19,15 @@ It is written in pure Ruby but works faster than 'cgi.rb'.
 * Faster and more lightweight than 'cgi.rb'.
 * Available to install with CGIExt (which is a re-implementation of 'cgi.rb'
   in C extension).
+* FastCGI support
 
 
 ==  Install
 
-Download cgialt-0.0.1.tar.gz and install it according to the following:
+Download cgialt-0.0.2.tar.gz and install it according to the following:
 
-    $ tar xzf cgialt-0.0.1.tar.gz
-    $ cd cgialt-0.0.1/
+    $ tar xzf cgialt-0.0.2.tar.gz
+    $ cd cgialt-0.0.2/
     $ ruby setup.rb config
     $ ruby setup.rb setup
     $ sudo ruby setup.rb install
@@ -45,17 +48,24 @@ CGI class which is compatible with 'cgi.rb'.
    require 'rubygems'   # if you have installed with RubyGems
    require 'cgialt'
 
+If you want to use CGIAlt with FastCGI (fcgi.rb), require 'cgialt/fcgi'
+instead of 'fcgi'.
+
+   require 'cgialt'
+   require 'cgialt/fcgi'
+
 If you want to replace original 'cgi.rb' entirely by 'cgialt',
 create 'cgi.rb' which requires 'cgialt' under proper directory such as
 '/usr/local/lib/ruby/site_ruby/1.8'.
 
    $ sudo echo 'require &quot;cgialt&quot;' &gt; /usr/local/lib/ruby/site_ruby/1.8/cgi.rb
+   $ sudo echo 'require &quot;cgialt/fcgi&quot;' &gt; /usr/local/lib/ruby/site_ruby/1.8/fcgi.rb
 
 When $DEBUG is true or ENV['DEBUG'] is set, CGIAlt prints release number
 to $stderr when loaded.
 
    $ DEBUG=1 ruby -e 'require &quot;cgi&quot;'
-   *** CGIAlt: release 0.0.1
+   *** CGIAlt: release 0.0.2
 
 
 == Benchmark
@@ -92,8 +102,9 @@ The following is an example of benchmark.
     CGI#header (simple)                  6.0400    0.0100    6.0500 (   6.0553)
     CGI#header (complex)                36.2200    0.0400   36.2600 (  36.3138)
 
+
 It is good thing for performance to install CGIExt as well as CGIAlt.
-The following is an benchmark example of using both CGIAlt and CGIExt.
+The following is a benchmark example of using both CGIAlt and CGIExt.
 
     ## CGIAlt and CGIExt
     $ ruby -s bench.rb -N=1000 -cgialt -cgiext
@@ -110,16 +121,28 @@ The following is an benchmark example of using both CGIAlt and CGIExt.
     CGI#header (simple)                  6.0300    0.0100    6.0400 (   6.0651)
     CGI#header (complex)                36.5400    0.0800   36.6200 (  37.0642)
 
+
 The following is a summary of above benchmark results.
 
-     Table 1. summary of benchmark
-                                          cgi.rb      CGIAlt   CGIAlt+CGIExt
-     -----------------------------------------------------------------------
-     require &quot;cgi&quot;         (x1000)         13.16        7.89         9.18
-     CGI#new (simple)      (x100000)       20.34       14.53        12.46
-     CGI#new (comple)      (x100000)       26.62       20.10        13.19
-     CGI#header (simple)   (x1000000)      12.68        6.05         6.04
-     CGI#header (complex)  (x1000000)      43.52       36.26        36.62
+    Table 1. summary of benchmark
+                                       cgi.rb      CGIAlt        CGIAlt+CGIExt
+    ---------------------------------------------------------------------------
+    require &quot;cgi&quot;         (x1000)       13.16      7.89 ( 67%)      9.18 ( 43%)
+    CGI#new (simple)      (x100000)     20.34     14.53 ( 40%)     12.46 ( 63%)
+    CGI#new (comple)      (x100000)     26.62     20.10 ( 32%)     13.19 (102%)
+    CGI#header (simple)   (x1000000)    12.68      6.05 (110%)      6.04 (110%)
+    CGI#header (complex)  (x1000000)    43.52     36.26 ( 20%)     36.62 ( 19%)
+
+
+Another benchmark script 'bench.fcgi' is provided. It is for FastCGI.
+The following is an example result of benchmark.
+
+    Table 2. result of bench.fcgi
+                                   Time taken for tests     Request per second
+    --------------------------------------------------------------------------
+    cgi    + fcgi                          16.686 [sec]        1198.61 [#/sec]
+    cgialt + cgialt/fcgi                   15.562 [sec]        1285.18 [#/sec]
+    cgialt + cgialt/fcgi + cgiext          15.310 [sec]        1306.34 [#/sec]
 
 
 == License
@@ -127,7 +150,7 @@ The following is a summary of above benchmark results.
 Ruby's license
 
 
-== Authoer
+== Author
 
 makoto kuwata &lt;kwa(at)kuwata-lab.com&gt;
 </diff>
      <filename>README.txt</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,6 @@
 ##
 ## $Rev: 30 $
-## $Release: 0.0.1 $
+## $Release: 0.0.2 $
 ## copyright(c) 2007 kuwata-lab.com all rights reserved.
 ##
 </diff>
      <filename>bench.rb</filename>
    </modified>
    <modified>
      <diff>@@ -2,7 +2,7 @@
 
 ###
 ### $Rev: 28 $
-### $Release: 0.0.1 $
+### $Release: 0.0.2 $
 ### copyright(c) 2007 kuwata-lab.com all rights reserved.
 ###
 
@@ -12,7 +12,7 @@ spec = Gem::Specification.new do |s|
   ## package information
   s.name        = &quot;cgialt&quot;
   s.author      = &quot;makoto kuwata&quot;
-  s.version     = &quot;0.0.1&quot;
+  s.version     = &quot;0.0.2&quot;
   s.platform    = Gem::Platform::RUBY
   s.homepage    = &quot;http://cgialt.rubyforge.org/&quot;
   s.summary     = &quot;an alternative of 'cgi.rb' in pure Ruby&quot;</diff>
      <filename>cgialt.gemspec</filename>
    </modified>
    <modified>
      <diff>@@ -31,7 +31,7 @@
 # protocol.
 
 class CGI
-  RELEASE = ('$Release: 0.0.1 $' =~ /[.\d]+/) &amp;&amp; $&amp;
+  RELEASE = ('$Release: 0.0.2 $' =~ /[.\d]+/) &amp;&amp; $&amp;
   if $DEBUG || ENV['DEBUG']
     $stderr.puts &quot;*** CGIAlt: release #{RELEASE}&quot;
   end</diff>
      <filename>lib/cgialt.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
 ##
-## copyright(c) 2007 kuwata-lab.com all rights reserved.
-##
 ## Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
 ##
 ## Copyright (C) 2000  Information-technology Promotion Agency, Japan
@@ -9,6 +7,9 @@
 ##
 ## Documentation: Wakou Aoyama (RDoc'd and embellished by William Webber)
 ##
+## $Rev: 32 $
+## $Release: 0.0.2 $
+## copyright(c) 2007 kuwata-lab.com all rights reserved.
 
 class CGI
 
@@ -77,13 +78,13 @@ class CGI
       if name.is_a?(String)
         @name = name
         @value = value  # value is an Array
-        @path = rexp.match(ENV['SCRIPT_NAME']) ? $&amp; : ''
+        @path = rexp.match($CGI_ENV['SCRIPT_NAME']) ? $&amp; : ''
         @secure = false
       else
         options = name
         @name  = options['name']  or raise ArgumentError, &quot;`name' required&quot;
         @value = Array(options['value'])
-        @path  = options['path'] || (rexp.match(ENV['SCRIPT_NAME']) ? $&amp; : '')  # simple support for IE
+        @path  = options['path'] || (rexp.match($CGI_ENV['SCRIPT_NAME']) ? $&amp; : '')  # simple support for IE
         @domain  = options['domain']
         @expires = options['expires']
         @secure  = options['secure'] == true</diff>
      <filename>lib/cgialt/cookie.rb</filename>
    </modified>
    <modified>
      <diff>@@ -1,6 +1,4 @@
 ##
-## copyright(c) 2007 kuwata-lab.com all rights reserved.
-##
 ## Copyright (C) 2000  Network Applied Communication Laboratory, Inc.
 ##
 ## Copyright (C) 2000  Information-technology Promotion Agency, Japan
@@ -9,6 +7,9 @@
 ##
 ## Documentation: Wakou Aoyama (RDoc'd and embellished by William Webber)
 ##
+## $Rev: 32 $
+## $Release: 0.0.2 $
+## copyright(c) 2007 kuwata-lab.com all rights reserved.
 
 raise &quot;Please, use ruby 1.5.4 or later.&quot; if RUBY_VERSION &lt; &quot;1.5.4&quot;
 
@@ -257,6 +258,8 @@ class CGI
 
   # :stopdoc:
 
+  $CGI_ENV = ENV    # for FCGI support
+
   EOL = &quot;\r\n&quot;
   #*** original
   #*# String for carriage return
@@ -268,7 +271,7 @@ class CGI
   #*# Standard internet newline sequence
   #*EOL = CR + LF
   #*
-  #*REVISION = '$Id: core.rb 27 2007-12-08 23:17:16Z kwatch $' #:nodoc:
+  #*REVISION = '$Id: core.rb 32 2007-12-11 04:22:35Z kwatch $' #:nodoc:
   #*
   #*NEEDS_BINMODE = true if /WIN/ni.match(RUBY_PLATFORM) 
   #*
@@ -309,14 +312,24 @@ class CGI
   def env_table
     ENV
   end
+  #*** original
+  #*def env_table
+  #*  ENV
+  #*end
+  #/*** original
 
   def stdinput
     $stdin
   end
 
   def stdoutput
-    $DEFAULT_OUTPUT
+    $stdout
   end
+  #*** original
+  #*def stdoutput
+  #*  $DEFAULT_OUTPUT
+  #*end
+  #*** /original
 
   private :env_table, :stdinput, :stdoutput
 
@@ -424,9 +437,9 @@ class CGI
   def _header_for_string(content_type) #:nodoc:
     buf = ''
     if nph?()
-      buf &lt;&lt; &quot;#{ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}&quot;
+      buf &lt;&lt; &quot;#{$CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'} 200 OK#{EOL}&quot;
       buf &lt;&lt; &quot;Date: #{CGI.rfc1123_date(Time.now)}#{EOL}&quot;
-      buf &lt;&lt; &quot;Server: #{ENV['SERVER_SOFTWARE']}#{EOL}&quot;
+      buf &lt;&lt; &quot;Server: #{$CGI_ENV['SERVER_SOFTWARE']}#{EOL}&quot;
       buf &lt;&lt; &quot;Connection: close#{EOL}&quot;
     end
     buf &lt;&lt; &quot;Content-Type: #{content_type}#{EOL}&quot;
@@ -446,12 +459,12 @@ class CGI
     ## NPH
     options.delete('nph') if defined?(MOD_RUBY)
     if options.delete('nph') || nph?()
-      protocol = ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'
+      protocol = $CGI_ENV['SERVER_PROTOCOL'] || 'HTTP/1.0'
       status = options.delete('status')
       status = HTTP_STATUS[status] || status || '200 OK'
       buf &lt;&lt; &quot;#{protocol} #{status}#{EOL}&quot;
       buf &lt;&lt; &quot;Date: #{CGI.rfc1123_date(Time.now)}#{EOL}&quot;
-      options['server'] ||= ENV['SERVER_SOFTWARE'] || ''
+      options['server'] ||= $CGI_ENV['SERVER_SOFTWARE'] || ''
       options['connection'] ||= 'close'
     end
     ## common headers
@@ -494,7 +507,7 @@ class CGI
   private :_header_for_hash
 
   def nph?  #:nodoc:
-    return /IIS\/(\d+)/n.match(ENV['SERVER_SOFTWARE']) &amp;&amp; $1.to_i &lt; 5
+    return /IIS\/(\d+)/n.match($CGI_ENV['SERVER_SOFTWARE']) &amp;&amp; $1.to_i &lt; 5
   end
 
   def _header_for_modruby(buf)  #:nodoc:
@@ -702,7 +715,7 @@ class CGI
     content = convert_content(content, options)
     options['length'] = content.length.to_s
     stdout.print header(options)
-    stdout.print content unless ENV['REQUEST_METHOD'] == 'HEAD'
+    stdout.print content unless $CGI_ENV['REQUEST_METHOD'] == 'HEAD'
   end
   def convert_content(content, options)  #:nodoc:
     charset = options['charset']
@@ -823,88 +836,88 @@ class CGI
   module QueryExtension
 
     ## return Integer(ENV['CONTENT_LENGTH'])
-    def content_length    ; return Integer(ENV['CONTENT_LENGTH']) ; end
+    def content_length    ; return Integer($CGI_ENV['CONTENT_LENGTH']) ; end
 
     ## return Integer(ENV['SERVER_PORT'])
-    def server_port       ; return Integer(ENV['SERVER_PORT'])    ; end
+    def server_port       ; return Integer($CGI_ENV['SERVER_PORT'])    ; end
 
     ## return ENV['AUTH_TYPE']
-    def auth_type         ; return ENV['AUTH_TYPE']            ; end
+    def auth_type         ; return $CGI_ENV['AUTH_TYPE']            ; end
 
     ## return ENV['CONTENT_TYPE']
-    def content_type      ; return ENV['CONTENT_TYPE']         ; end
+    def content_type      ; return $CGI_ENV['CONTENT_TYPE']         ; end
 
     ## return ENV['GATEWAY_INTERFACE']
-    def gateway_interface ; return ENV['GATEWAY_INTERFACE']    ; end
+    def gateway_interface ; return $CGI_ENV['GATEWAY_INTERFACE']    ; end
 
     ## return ENV['PATH_INFO']
-    def path_info         ; return ENV['PATH_INFO']            ; end
+    def path_info         ; return $CGI_ENV['PATH_INFO']            ; end
 
     ## return ENV['PATH_TRANSLATED']
-    def path_translated   ; return ENV['PATH_TRANSLATED']      ; end
+    def path_translated   ; return $CGI_ENV['PATH_TRANSLATED']      ; end
 
     ## return ENV['QUERY_STRING']
-    def query_string      ; return ENV['QUERY_STRING']         ; end
+    def query_string      ; return $CGI_ENV['QUERY_STRING']         ; end
 
     ## return ENV['REMOTE_ADDR']
-    def remote_addr       ; return ENV['REMOTE_ADDR']          ; end
+    def remote_addr       ; return $CGI_ENV['REMOTE_ADDR']          ; end
 
     ## return ENV['REMOTE_HOST']
-    def remote_host       ; return ENV['REMOTE_HOST']          ; end
+    def remote_host       ; return $CGI_ENV['REMOTE_HOST']          ; end
 
     ## return ENV['REMOTE_IDENT']
-    def remote_ident      ; return ENV['REMOTE_IDENT']         ; end
+    def remote_ident      ; return $CGI_ENV['REMOTE_IDENT']         ; end
 
     ## return ENV['REMOTE_USER']
-    def remote_user       ; return ENV['REMOTE_USER']          ; end
+    def remote_user       ; return $CGI_ENV['REMOTE_USER']          ; end
 
     ## return ENV['REQUEST_METHOD']
-    def request_method    ; return ENV['REQUEST_METHOD']       ; end
+    def request_method    ; return $CGI_ENV['REQUEST_METHOD']       ; end
 
     ## return ENV['SCRIPT_NAME']
-    def script_name       ; return ENV['SCRIPT_NAME']          ; end
+    def script_name       ; return $CGI_ENV['SCRIPT_NAME']          ; end
 
     ## return ENV['SERVER_NAME']
-    def server_name       ; return ENV['SERVER_NAME']          ; end
+    def server_name       ; return $CGI_ENV['SERVER_NAME']          ; end
 
     ## return ENV['SERVER_PROTOCOL']
-    def server_protocol   ; return ENV['SERVER_PROTOCOL']      ; end
+    def server_protocol   ; return $CGI_ENV['SERVER_PROTOCOL']      ; end
 
     ## return ENV['SERVER_SOFTWARE']
-    def server_software   ; return ENV['SERVER_SOFTWARE']      ; end
+    def server_software   ; return $CGI_ENV['SERVER_SOFTWARE']      ; end
 
     ## return ENV['HTTP_ACCEPT']
-    def accept            ; return ENV['HTTP_ACCEPT']          ; end
+    def accept            ; return $CGI_ENV['HTTP_ACCEPT']          ; end
 
     ## return ENV['HTTP_ACCEPT_CHARSET']
-    def accept_charset    ; return ENV['HTTP_ACCEPT_CHARSET']  ; end
+    def accept_charset    ; return $CGI_ENV['HTTP_ACCEPT_CHARSET']  ; end
 
     ## return ENV['HTTP_ACCEPT_ENCODING']
-    def accept_encoding   ; return ENV['HTTP_ACCEPT_ENCODING'] ; end
+    def accept_encoding   ; return $CGI_ENV['HTTP_ACCEPT_ENCODING'] ; end
 
     ## return ENV['HTTP_ACCEPT_LANGUAGE']
-    def accept_language   ; return ENV['HTTP_ACCEPT_LANGUAGE'] ; end
+    def accept_language   ; return $CGI_ENV['HTTP_ACCEPT_LANGUAGE'] ; end
 
     ## return ENV['HTTP_CACHE_CONTROL']
-    def cache_control     ; return ENV['HTTP_CACHE_CONTROL']   ; end
+    def cache_control     ; return $CGI_ENV['HTTP_CACHE_CONTROL']   ; end
 
     ## return ENV['HTTP_FROM']
-    def from              ; return ENV['HTTP_FROM']            ; end
+    def from              ; return $CGI_ENV['HTTP_FROM']            ; end
 
     ## return ENV['HTTP_HOST']
-    def host              ; return ENV['HTTP_HOST']            ; end
+    def host              ; return $CGI_ENV['HTTP_HOST']            ; end
 
     ## return ENV['HTTP_NEGOTIATE']
-    def negotiate         ; return ENV['HTTP_NEGOTIATE']       ; end
+    def negotiate         ; return $CGI_ENV['HTTP_NEGOTIATE']       ; end
 
     ## return ENV['HTTP_PRAGMA']
-    def pragma            ; return ENV['HTTP_PRAGMA']          ; end
+    def pragma            ; return $CGI_ENV['HTTP_PRAGMA']          ; end
 
     ## return ENV['HTTP_REFERER']
-    def referer           ; return ENV['HTTP_REFERER']         ; end
+    def referer           ; return $CGI_ENV['HTTP_REFERER']         ; end
 
     ## return ENV['HTTP_USER_AGENT']
-    def user_agent        ; return ENV['HTTP_USER_AGENT']      ; end
+    def user_agent        ; return $CGI_ENV['HTTP_USER_AGENT']      ; end
 
     #*** orignal
     #*%w[ CONTENT_LENGTH SERVER_PORT ].each do |env|
@@ -929,7 +942,7 @@ class CGI
 
     # Get the raw cookies as a string.
     def raw_cookie
-      return ENV['HTTP_COOKIE']
+      return $CGI_ENV['HTTP_COOKIE']
     end
     #*** original
     #*def raw_cookie
@@ -939,7 +952,7 @@ class CGI
 
     # Get the raw RFC2965 cookies as a string.
     def raw_cookie2
-      return ENV['HTTP_COOKIE2']
+      return $CGI_ENV['HTTP_COOKIE2']
     end
     #*** original
     #*def raw_cookie2
@@ -1064,7 +1077,7 @@ class CGI
       return body
     end
     def unescape_filename?  #:nodoc:
-      user_agent = ENV['HTTP_USER_AGENT']
+      user_agent = $CGI_ENV['HTTP_USER_AGENT']
       return /Mac/ni.match(user_agent) &amp;&amp; /Mozilla/ni.match(user_agent) &amp;&amp; !/MSIE/ni.match(user_agent)
     end
     #*** original
@@ -1222,16 +1235,16 @@ class CGI
     # Handles multipart forms (in particular, forms that involve file uploads).
     # Reads query parameters in the @params field, and cookies into @cookies.
     def initialize_query()
-      case ENV['REQUEST_METHOD']
+      case $CGI_ENV['REQUEST_METHOD']
       when 'GET', 'HEAD'
-        query_str = defined?(MOD_RUBY) ? Apache::request.args : ENV['QUERY_STRING']
+        query_str = defined?(MOD_RUBY) ? Apache::request.args : $CGI_ENV['QUERY_STRING']
         @params = CGI.parse(query_str || '')
         @multipart = false
       when 'POST'
-        content_length = Integer(ENV['CONTENT_LENGTH'])
-        if /\Amultipart\/form-data/.match(ENV['CONTENT_TYPE'])
+        content_length = Integer($CGI_ENV['CONTENT_LENGTH'])
+        if /\Amultipart\/form-data/.match($CGI_ENV['CONTENT_TYPE'])
           raise StandardError.new(&quot;too large multipart data.&quot;) if content_length &gt; MAX_MULTIPART_LENGTH
-          unless /boundary=(?:&quot;([^&quot;;,]+?)&quot;|([^;,\s]+))/.match(ENV['CONTENT_TYPE'])
+          unless /boundary=(?:&quot;([^&quot;;,]+?)&quot;|([^;,\s]+))/.match($CGI_ENV['CONTENT_TYPE'])
             raise StandardError.new(&quot;no boundary of multipart data.&quot;)
           end
           boundary = $1 || $2
@@ -1249,7 +1262,7 @@ class CGI
         @params = Hash.new([].freeze)
         @multipart = false
       end
-      @cookies = CGI::Cookie.parse(ENV['HTTP_COOKIE'] || ENV['COOKIE'])
+      @cookies = CGI::Cookie.parse($CGI_ENV['HTTP_COOKIE'] || $CGI_ENV['COOKIE'])
       nil
     end
     private :initialize_query
@@ -1383,7 +1396,7 @@ class CGI
   # cookies and other parameters are parsed automatically from the standard
   # CGI locations, which varies according to the REQUEST_METHOD.
   def initialize(type=nil)
-    if defined?(MOD_RUBY) &amp;&amp; !ENV['GATEWAY_INTERFACE']
+    if defined?(MOD_RUBY) &amp;&amp; !$CGI_ENV['GATEWAY_INTERFACE']
       Apache.request.setup_cgi_env
     end
     ##</diff>
      <filename>lib/cgialt/core.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>2ab4a7249238917bf8fe799936f01ecf9578e88b</id>
    </parent>
  </parents>
  <author>
    <name>makoto kuwata</name>
    <email>kwa@kuwata-lab.com</email>
  </author>
  <url>http://github.com/kwatch/cgialt/commit/386b7d0f748534f896f3499110ae69c9aa0b2cab</url>
  <id>386b7d0f748534f896f3499110ae69c9aa0b2cab</id>
  <committed-date>2008-11-07T19:59:01-08:00</committed-date>
  <authored-date>2008-11-07T19:59:01-08:00</authored-date>
  <message>Register CGIAlt 0.0.2 files.</message>
  <tree>c7a50a9a10164baa759ad962ca0091e7006d14f7</tree>
  <committer>
    <name>makoto kuwata</name>
    <email>kwa@kuwata-lab.com</email>
  </committer>
</commit>
