On Sat, 24 May 2003, Hal E. Fulton wrote:

> I'm betting this is either impossible or highly browser-dependent.
>
> It's not entirely obvious to me that a web server is needed to run a CGI
> that is *on the local machine*. (As, by analogy, we don't need to run a
> server just to look at local static HTML files.)
>
> Yet while it seems theoretically possible that a browser could do this, I
> don't know whether any of them actually will.
>
> Just to stay somewhat on-topic -- I have downloaded Webrick, I just haven't
> yet understood it.  :)
>
> So, a serverless CGI -- possible in theory and practice, in theory only, or
> just not happening?

~ > cat foo.cgi
#!/usr/local/bin/ruby
require 'cgi'
cgi = CGI.new
content = ''
cgi.keys.map{|k| content << k << "->" << cgi[k][0] << "\n"}
ENV.each{|e| content << (e.join("=") + "\n")}
cgi.out { content }

~ > cat query
foo=bar
bar=foo

~ > env -i FOO=BAR BAR=FOO ./foo.cgi < query
Content-Type: text/html
Content-Length: 34

foo->bar
bar->foo
FOO=BAR
BAR=FOO


-a
--
  ====================================
  | Ara Howard
  | NOAA Forecast Systems Laboratory
  | Information and Technology Services
  | Data Systems Group
  | R/FST 325 Broadway
  | Boulder, CO 80305-3328
  | Email: ara.t.howard / fsl.noaa.gov
  | Phone:  303-497-7238
  | Fax:    303-497-7259
  | ~ > ruby -e 'p % ^) .intern'
  ====================================