From owner-freebsd-questions Tue Feb 16 9:13:10 1999 Received: from wolf.com (ns1.wolf.com [207.137.58.20]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id JAA11432 for ; Tue, 16 Feb 1999 09:13:07 -0800 (PST) (envelope-from dan@wolf.com) From: dan@wolf.com Received: (from dan@localhost) by wolf.com (8.9.1/8.9.1) id IAA31772; Tue, 16 Feb 1999 08:27:56 -0800 Message-ID: <19990216082756.A31610@ns.wolf.com> Date: Tue, 16 Feb 1999 08:27:56 -0800 To: keith@apcs.com.au, questions@FreeBSD.ORG Subject: Re: www cgi forms References: Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Mailer: Mutt 0.93.2 In-Reply-To: ; from Keith Anderson on Tue, Feb 16, 1999 at 08:37:07PM +1100 Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG > I'm having a problem passing information to my cgi's. > I made a little test program to echo back anything I sent it (see below eecho.c) Yep, I see the problem - neither of the 2 recognized methods of transferring info to a CGI (POST and GET) pass info via calling arguments. If you use GET, the form values getted passed through the QUERY_STRING environment variable. If you use POST the form values get passwd via stdin with the total length of all variables passed in the CONTENT_LENGTH environment variable. I recommend "CGI Developers Guide" by Eugene Kim. From Chapter 5 of his book, there's a function called ReadParse that does what you want in Perl. I'll leave it to you to recode it in C :-) sub ReadParse { local (*in) = @_ if @_; local ($i, $key, $val); if (&MethGet) { $in = $ENV{'QUERY_STRING'}; } elsif (&MethPost) { read(STDIN, $in, $ENV{'CONTENT_LENGTH'}); } @in = split(/[&;]/, $in); .... then continues to unescape the escaped values. Dan Mahoney dan@wolf.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message