First of all, I think it would be great, as Eustaquio suggests, to
be able to distinguish between CGI GET and POST vars.

However, having said that, as a Web programmer who started
work mostly with ASP/PHP and now work with Ruby and Perl,
I have to say that the biggest deficiency in cgi.rb is that
using POST method makes variables disappear completely from
the query string of the processing file (i.e., the "action"
property of the Web form).

It is common practice in Web programming to pass non-changing
values (like a session ID) around on the query string in an
automated fashion, even if posting a form (e.g.,
<form method="POST" action="proc.rbx?sessionid=adsfasdf2112">).

In the Web programming languages that a lot of people start out
on, there is one single place to look for all data coming back
to the processing page (PHP's $_REQUEST and ASP's Request).
This is farily intuitive, and only becomes an issue when
you make the bonehead mistake of using two identically named
variables -- and as long as rules of precence are documented
(i.e., GET before POST), it's not usually a big issue, in
my experience.

I have a feeling there will be more and more Web programmers
like me who will be trying out Ruby, and unless there is some
specific reason to make it an exclusive 'either/or' choice,
it might be nice if cgi.rb acted as intuitively for Web
programmers as the rest of Ruby does.

Again, I think Eustaquio has a good idea -- but for me the
biggest issue is that vanishing query string.

bollowing is a patch I've been using for awhile with cgi.rb
languages 
to keep query string variables from disappearing when I use a
POST. I'd love to know if there's a better or 'more Rubyish'
way to do it.

Thanks.


Matthew

--- cgi.rb      2004-11-01 17:49:15.000000000 -0600
+++ cgi.rb.new  2004-12-22 22:30:00.000000000 -0600
@@ -1102,24 +1102,28 @@
         @multipart = true
         @params = read_multipart(boundary, Integer(env_table['CONTENT_LENGTH']))
       else
-        @multipart = false
-        @params = CGI::parse(
-                    case env_table['REQUEST_METHOD']
-                    when "GET", "HEAD"
-                      if defined?(MOD_RUBY)
-                        Apache::request.args or ""
-                      else
-                        env_table['QUERY_STRING'] or ""
-                      end
-                    when "POST"
-                      stdinput.binmode if defined? stdinput.binmode
-                      stdinput.read(Integer(env_table['CONTENT_LENGTH'])) or ''
-                    else
-                      read_from_cmdline
-                    end
-                  )
+          allparams = ''
+            case env_table['REQUEST_METHOD']
+              when "GET", "HEAD", "POST"
+                if defined?(MOD_RUBY)
+                  allparams += (Apache::request.args or '')
+                else
+                  allparams += (env_table['QUERY_STRING'] or '')
+                end
+                if env_table['REQUEST_METHOD'] == 'POST'
+                  if not allparams.empty?
+                    allparams += '&'
+                  end
+                  stdinput.binmode if defined? stdinput.binmode
+                  allparams += (stdinput.read(Integer(env_table['CONTENT_LENGTH'])) or '')
+                end
+              else
+                allparams = read_from_cmdline
+              end
+          @multipart = false
+          @params = CGI::parse(allparams)
       end
-
+
  
       @cookies = CGI::Cookie::parse((env_table['HTTP_COOKIE'] or env_table['COOKIE']))
     end
     private :initialize_query