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:

static int add_argv(const char *a, const char *b, int decode)
{
        ...
        } else
                tmp = 0;
        cgi_argv[cgi_argc] = tmp;
        /* HERE IS THE LINE I INSERTED */
        log_d ("toby_log: add_argv: %s", tmp);
        ++cgi_argc;
        return 0;
}

I then ran mathopd with the -dn flags and all I got in the
mathopd.errors file was the following:

Mon Mar 25 18:13:16 2002 [23594] httpd_main: select(7) ...
Mon Mar 25 18:13:16 2002 [23594] httpd_main: select() = 1
Mon Mar 25 18:13:16 2002 [23594] read_connection: recv(6, 0x825f981,
1583, MSG_PEEK) = 82
Mon Mar 25 18:13:16 2002 [23594] read_connection: recv(6, 0x825f981, 71,
0) = 71
Mon Mar 25 18:13:16 2002 [23594] method_s = "POST"
Mon Mar 25 18:13:16 2002 [23594] version = "HTTP/1.1"
Mon Mar 25 18:13:16 2002 [23594] url = "/form2.rb"
Mon Mar 25 18:13:16 2002 [23594] user_agent = "Mozilla/5.0 (X11; U;
Linux i686; en-US; rv:0.9.8) Gecko/20020214"
Mon Mar 25 18:13:16 2002 [23594] referer =
"http://localhost:8080/form.html";
Mon Mar 25 18:13:16 2002 [23594] host = "localhost:8080"
Mon Mar 25 18:13:16 2002 [23594] connection = "keep-alive"
Mon Mar 25 18:13:16 2002 [23594] in_content_type =
"application/x-www-form-urlencoded"
Mon Mar 25 18:13:16 2002 [23594] in_content_length = "11"
Mon Mar 25 18:13:16 2002 [23594] get_path_info:
stat("/home/anany/web/form2.rb") = 0; st_mode = 0100755
Mon Mar 25 18:13:16 2002 [23594] child process 23597 created
Mon Mar 25 18:13:16 2002 [23594] close_connection: close(6) = 0
Mon Mar 25 18:13:16 2002 [23594] httpd_main: select(5) ...
Mon Mar 25 18:13:16 2002 [23597] fork_request: child process created
Mon Mar 25 18:13:16 2002 [23597] fork_request: dup2(6, 0) = 0
Mon Mar 25 18:13:16 2002 [23597] fork_request: dup2(6, 1) = 1
Mon Mar 25 18:13:16 2002 [23597] fork_request: dup2(6, 2) = 2
Mon Mar 25 18:13:16 2002 [23597] fork_request: fcntl(0, F_SETFL, 0) = 0
Mon Mar 25 18:13:16 2002 [23597] fork_request: fcntl(1, F_SETFL, 0) = 0
Mon Mar 25 18:13:16 2002 [23597] fork_request: fcntl(2, F_SETFL, 0) = 0
Mon Mar 25 18:13:16 2002 [23597] fork_request: close(6) = 0
Mon Mar 25 18:13:16 2002 [23597] init_cgi_env: chdir("/home/anany/web")
= 0
Mon Mar 25 18:13:16 2002 [23597] dnslookup: gethostbyaddr(127.0.0.1)
Mon Mar 25 18:13:16 2002 [23597] toby_log: add_argv: /usr/local/bin/ruby
Mon Mar 25 18:13:16 2002 [23597] toby_log: add_argv:
/home/anany/web/form2.rb
Mon Mar 25 18:13:16 2002 [23597] toby_log_shit: add_argv: (null)
Mon Mar 25 18:13:16 2002 [23597] executing /usr/local/bin/ruby
Mon Mar 25 18:13:16 2002 [23594] httpd_main: select() = -1
Mon Mar 25 18:13:16 2002 [23594] child process 23597 exited with status
0

Now I was thinking that surely I would see the arguments there, but I
didn't, as you can plainly see. Where are the arguments for CGIs stored
in mathopd (which data structure, I mean)? And in what part of the code
do they get transferred to the CGI?

Thanks in advance!

-- 
<< T o b i a s   D i P a s q u a l e >>
web: http://cbcg.net/
mailto: [EMAIL PROTECTED]
trade: Software Engineer 
skillset: Linux/UNIX/C/Java/Ruby

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to