On 2012-02-08 15:51, Adam D. Ruppe wrote:
On Wednesday, 8 February 2012 at 07:37:23 UTC, Jacob Carlborg wrote:
Maybe Adam's code can be used as a base of implementing a library like
Rack in D.
http://rack.rubyforge.org/
That looks like it does the same job as cgi.d.
cgi.d actually offers a uniform interface across various
web servers and integration methods.
If you always talk through the Cgi class, and use the GenericMain
mixin, you can run the same program with:
1) cgi, tested on Apache and IIS (including implementations for methods
that don't work on one or the other natively)
2) fast cgi (using the C library)
3) HTTP itself (something I expanded this last weekend and still want
to make better)
Sometimes I think I should rename it, to reflect this, but meh,
misc-stuff-including blah blah shows how good I am at names!
It seems Rack supports additional interface next to CGI. But I think we
could take this one step further. I'm not entirely sure what APIs Rack
provides but in Rails they have a couple of method to uniform the
environment variables.
For example, ENV["REQUEST_URI"] returns differently on different
servers. Rails provides a method, "request_uri" on the request object
that will return the same value on all different servers.
I don't know if CGI already has support for something similar.
--
/Jacob Carlborg