POST/CGI arguments?

Tobias DiPasquale <[email protected]>
Newsgroups gmane.network.mathopd
Message-ID <1017098383.23650.6.camel@cbcg>
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
signature.asc (application/pgp-signature, 524 B)
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.6 (GNU/Linux)
Comment: For info see http://www.gnupg.org

iQEXAwUAPJ+wj9oc4r8dJvA2FAIFRgQAh7vvXvNtfkaZCzxL1cGN0A/In3VnJoEW
wos5oRFu6myu6a4pUdXiFtgxOpUUnNc4IQvchjQjjmsa09YANfTXX9P+yapSuTVo
1LIY2Npk8bsOuQQZw8QpjvyBzTgitUWkMEZMb7D/ShrIbQua75GBk+h7MStyKcB0
JemvxYgKXHID/idM+bG9VCJHeV7ySo1Blqpb5LS6/wWcacPtAQ18VGgxm3TqwKDO
Ty2mKTYCjoV5bX36xt9tD9aU2EKMtjwy2rNXlG/GmeCE3E/v7138k+P2ylWC5ht1
ZQXmv0FpYUFGr9wfEGD1RBP1exM28HQrck23oLxd0tWvBBkmezSwM+hY
=P4wv
-----END PGP SIGNATURE-----
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.