Re: [Erlyaws-list] ScriptAlias equivalent?

On 11/8/06, Carsten Schultz <carsten@...> wrote:
> I attach an old appmod that I have found on my hard drive. Iirc, I used
> it even before cgi support was fully integrated into yaws. I do not
> know if it works with a current version of yaws, you will have to use it
> as an example.
>
> It implements a directory in which everything with a certain extension
> (which can be empty) is called as a cgi script. It is configured via
> variables in yaws.conf, these are `cgidir' and `cgiext'.
[...]
> Is the example sufficiently clear?
Not completely no, but that's only becauase I'm stilll learning
Erlang. Before I saw this message I had written a simple module to
attempt to handle Mailman's cgi-bin programs.
In yaws.conf:
appmods =3D </lists, mailman>
Which I expect to handle URLs like:
http://site.com/lists/listinfohttp://site.com/lists/listinfo/foobar-devhttp://site.com/lists/options/foobar-dev/calmasy%40gmail.com
etc..
Only the first part of the path after 'lists' is the cgi-bin
executable. In the above cases, 'listinfo' is
/usr/lib/cgi-bin/mailman/listinfo and 'options' is
/usr/lib/cgi-bin/mailman/options. The parts of the URL following
those are just arguments to the CGI I guess (sorry, not that familiar
with how CGI works).
So I wrote a simple mailman.erl:
-module(mailman).
-include("../include/yaws_api.hrl").
-compile(export_all).
out(Arg) ->
Req =3D Arg#arg.req,
{abs_path, Path} =3D Req#http_request.path,
Script =3D Arg#arg.appmoddata,
yaws_cgi:call_cgi(Arg, "/usr/lib/cgi-bin/mailman/" ++ Script).
This correctly handles the first example URL above (lists/listinfo)
but not the others. I guess I'm not understanding how to pass
arguments to the CGI ('foobar-dev' and
'foobar-dev/calmasy%40gmail.com' in the above examples), because
doesn't call_cgi just accept Arg and the full path to the executable?
How do I pass on the remainer of the URL?
--=20
Cheers, L=E1szl=F3

Community

Help

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

CountryState

JavaScript is required for this form.

I agree to receive quotes, newsletters and other information from sourceforge.net and its partners regarding IT services and products. I understand that I can withdraw my consent at any time. Please refer to our Privacy Policy or Contact Us for more details