From owner-freebsd-questions Tue Mar 11 15:21:33 2003 Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id C58D037B401 for ; Tue, 11 Mar 2003 15:21:31 -0800 (PST) Received: from vega.blacktrap.net (vega.blacktrap.net [194.9.222.35]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9A1AF43FF5 for ; Tue, 11 Mar 2003 15:21:30 -0800 (PST) (envelope-from oli@vega.blacktrap.net) Received: from vega.blacktrap.net (localhost [127.0.0.1]) by vega.blacktrap.net (8.12.6/8.12.6) with ESMTP id h2BNLxfc011992 for ; Wed, 12 Mar 2003 00:21:59 +0100 (CET) (envelope-from oli@vega.blacktrap.net) Received: (from oli@localhost) by vega.blacktrap.net (8.12.6/8.12.6/Submit) id h2BNLxjS011991 for freebsd-questions@freebsd.org; Wed, 12 Mar 2003 00:21:59 +0100 (CET) Date: Wed, 12 Mar 2003 00:21:59 +0100 From: Olivier Dony To: FreeBSD-questions Subject: POST data not available in cgi perl scripts Message-ID: <20030311232159.GA11475@vega.blacktrap.net> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.4i X-Spam-Status: No, hits=-5.1 required=5.0 tests=HTML_00_10,HTML_MESSAGE,USER_AGENT_MUTT version=2.50 X-Spam-Checker-Version: SpamAssassin 2.50 (1.173-2003-02-20-exp) Sender: owner-freebsd-questions@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG I understand this might be a little off topic but I can only reproduce the problem on one of my FreeBSD server, so it's not that much OT. It's very simple, the data from a HTTP POST never reaches my CGI perl scripts. There are no errors in the server log, the CGI executes fine, no debug with CGI::Carp, etc.. only thing is that the POST data is always empty. And that no matter what browser I use of course. Also I'm using CGI.pm, but handling it by hand yields the same results. The POST DATA is always empty. Though if I run my script with 'perl -c' in interactive mode and POST something it works ok and the script gets my POST DATA without problem. Displaying the %ENV shows the correct QUERY_STRING when using GET, but with POST the POST DATA never makes it to the script. This happens only on one of my FreeBSD : 4.7-RELEASE, apache 1.3.27, system perl v5.005_03, whereas the same CGI scripts run fine on my other 5.0-RELEASE and 4.4-RELEASE, with the same apache version, and perl different or the same. I have no idea where or what I could look to solve the problem. Maybe others have had the same issue or any perl/cgi gurus have any ideas for me? I will be glad to provide any additional info or config files. TIA a lot for any hints -- Olivier PS: An example of a very basic test that fails, I POST into this CGI script, and the output of the POST data is empty, though CONTENT_LENGTH is correct : #!/usr/bin/perl -w print "Content-type:text/html\n\n"; read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); print "DATA: [$buffer]
\n"; # <- nothing output between the brackets here @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; } print ""; foreach $key (keys(%FORM)) { print "$key = $FORM{$key}
"; } # ^^^^^^^^^^^ here my output is always empty too foreach $key (sort(keys %ENV)) { print "$key = $ENV{$key}
\n"; } print "";
To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-questions" in the body of the message