httpd-apreq-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Eli Marmor <>
Subject Re: [PATCH] proposal to add interactive CGI module
Date Thu, 05 Oct 2006 10:34:20 GMT
(for honesty sake, I asked Issac to code it, after I did a similar thing
to another CGI library...)

I want to add a temporary README (i.e. Executive Summary for busy

A patch against module_cgi.c, that causes any apreq-based CGI program to
become interactive when run by the user and not by a web server.

Such CGI programs require a user running the program from an interactive
shell to manually populate the local environment with the appropriate
(QUERY_STRING, HTTP_COOKIE, CONTENT_LENGTH, etc) variables and prepare a
properly formatted POST body; Otherwise, apreq fails to work.

If the CGI was invoked not by a web server, it will prompt the user with
the needed parameter names upon demand, and read the typed-in values
(note: the original behavior is kept if QUERY_STRING is defined).

* cgi_body(_get)
* cgi_args(_get)
* cgi_jar(_get)
* cgi_param(s)
* apreq_handle_cgi

If interactive_mode has been detected, the above APIs will type a prompt
on stdout and await parameter values to be entered on stdin (lazily),
rather than parsing the appropriate brigade/environment variables.

1. Save the need to write 2 programs for each purpose (one CGI and one
   interactive).  The same program will handle both cases.
2. Allow easier debugging of CGI, by gdb etc.
3. Easier CGI-based scripting (one may write "echo joe | mycgi" rather
   than: "export QUERY_STRING='name=joe'; mycgi").
4. Extra behavior for existing programs without recompiling them.
5. Because it's cool  ;-)

Just run module/test_cgi.c with the the modified libapreq2.

Eli Marmor
Netmask (El-Mar) Internet Technologies Ltd.
Tel.:   +972-9-766-1020          8 Yad-Harutzim St.
Fax.:   +972-9-766-1314          P.O.B. 7004
Mobile: +972-50-5237338          Kfar-Saba 44641, Israel

View raw message