Browse files

Make call_cgi available in yaws_api.

git-svn-id: 9fbdc01b-0d2c-0410-bfb7-fb27d70d8b52
  • Loading branch information...
1 parent e75946b commit 42ab9903260f0335417bb2768c780c58d770cec6 @carsten3347 carsten3347 committed Aug 25, 2003
Showing with 37 additions and 1 deletion.
  1. +5 −0 doc/yaws.tex
  2. +12 −1 man/yaws_api.5
  3. +20 −0 src/yaws_api.erl
@@ -1556,6 +1556,11 @@ \chapter{External scripts via CGI}
then result in Yaws executing \verb+php+ and passing the name of the
corresponding file to it via the appropriate environment variable.
+These ways of calling CGI scripts are also available to \verb+.yaws+
+scripts and appmods via the functions \verb+yaws_api:call_cgi/2+ and
+\verb+yaws_api:call_cgi/3+. This makes it possible to write wrappers
+for CGI programs, irrespective of the value of \verb+allowed_scripts+.
This is a new feature in Yaws. It is used by its author for self
written CGI programs as well as for using a standard CGI package, so
it is working. You should not be surprised however, should some
@@ -316,9 +316,20 @@ record. The return list is suitable for retransmit.
Parse URL in a string, returns a #url record
Takes a #url record a formats the Url as a string
+\fBcall_cgi(Arg, Scriptfilename)\fR
+Calls an executable CGI script,
+given by its full path. Used to make `.yaws' wrappers for CGI
+programs. This function usually returns \fIstreamcontent\fR.
+\fBcall_cgi(Arg, Exefilename, Scriptfilename)\fR
+Like before, but
+calls \fIExefilename\fR to handle the script. The file name of the
+script is handed to the executable via a CGI meta variable.
.SH RETURN VALUES from out/1
@@ -42,6 +42,8 @@
+-export([call_cgi/2, call_cgi/3]).
-export([ehtml_expand/1, ehtml_expander/1, ehtml_apply/2,
@@ -1330,3 +1332,21 @@ ehtml_expander_test() ->
+% call_cgi calls the script `Scriptfilename' (full path). If
+% `Exefilename' is given, it is the executable to handle this,
+% otherwise `Scriptfilame' is assumed to be executable itself.
+% Note however, that these functions usually generate stream content.
+% (If you have good use for a version generating {content, _, _}
+% instead, contact
+% Also note, that they may return `get_more' and expect to be called
+% again.
+call_cgi(Arg, Scriptfilename) ->
+ yaws_cgi:call_cgi(Arg, Scriptfilename).
+call_cgi(Arg, Exefilename, Scriptfilename) ->
+ yaws_cgi:call_cgi(Arg, Exefilename, Scriptfilename).

0 comments on commit 42ab990

Please sign in to comment.