Tobias DiPasquale wrote:
> 
> Hi all,
> 
>         I was looking at the source today, trying to find the place where
> mathopd passes the arguments to CGIs, but was unable to locate it. I
> thought I did, when I came upon the add_argv function in cgi.c, but when
> I inserted the following line in the function, it failed to yield the
> POST parameters:

POST? i only see this in request.c:
        if (r->method == M_POST)
                return 405;

-> always returns 405 method not allowed

also, cgi parameters are normally not passed in argv[], but in the environment
(for GET parameters), or on stdin (for POST, which mathod doesn't seem to
support anyway).

simply try something like:
index.cgi:
#!/bin/bash
echo "HTTP/1.0 200 OK
Content-Type: text/plain
"
set


> static int add_argv(const char *a, const char *b, int decode)
[...]

with a bit of experimenting i found that mathopd passes GET parameters in
argv (split at spaces ("+", assuming the requets is  URLencoded)) if they
don't contain '='... (why anyway?)

that is in make_cgi_argv():
        a = r->args;
        if (a && strchr(a, '=') == 0)
                do {
                        w = strchr(a, '+');
                        if (add_argv(a, w, 1, cp) == -1)
                                return -1;
                        if (w)
                                a = w + 1;
                } while (w);

> << T o b i a s   D i P a s q u a l e >>


Thorben Thuermer

Reply via email to