www.digitalmars.com         C & C++   DMDScript  

D - server variables?

reply majbritt37 hotmail.com writes:
Hi,

I'm trying to write some CGI stuff in D. All I've done so far is a simple "Hello
world" program. What I need to know is how to get the server variables.
request_uri, remote_addr and all of those. Help is appreciated.

/Mårten
Jun 27 2003
parent reply Burton Radons <loth users.sourceforge.net> writes:
majbritt37 hotmail.com wrote:

 I'm trying to write some CGI stuff in D. All I've done so far is a simple
"Hello
 world" program. What I need to know is how to get the server variables.
 request_uri, remote_addr and all of those. Help is appreciated.
The CGI specification is here: http://hoohoo.ncsa.uiuc.edu/cgi/interface.html CGI stores various variables in the environment. You can retrieve them using getenv, such as with: private struct crt { static extern (C) char* getenv (char* varname); } char[] getenv (char[] varname) { return toString (crt.getenv (toStringz (varname))); } If you're feeling up to it, a CGI library would be a valuable contribution to the community because of the many obscure elements about the interface. The Python module for it is documented here (http://www.python.org/doc/current/lib/module-cgi.html); I've never used it, so I don't know how good it would be, but it might be helpful for reference.
Jun 27 2003
parent "Walter" <walter digitalmars.com> writes:
"Burton Radons" <loth users.sourceforge.net> wrote in message
news:bdii03$1oii$1 digitaldaemon.com...
 If you're feeling up to it, a CGI library would be a valuable
 contribution to the community because of the many obscure elements about
 the interface.
Yes. The new Phobos uri routines are a good start.
Jul 02 2003