Re: POST data not available in cgi perl scripts

2003-03-12 Thread Olivier Dony
On Wed, Mar 12, 2003 at 12:48:44PM +, Matthew Faircliff wrote:
 Hello,

Hiya,

 
 Have you tried using libapreq? I find that it is a superior method of transmitting 
 POST data. Find it in /usr/ports/www/p5-libapreq. 
 $my_posted_var = $r-parms{'my_var'};
 

Nope haven't tried it yet, because using CGI.pm was working for me on my other
servers, I never felt the need for a more clever thing, but I'll give it a try
for sure, this looks great.

 Also, why not look into Mason (like emb_perl, only better). It handles POST data 
 like a charm.

I'll have a look at it right now too.

But anyhow I don't think those will solve the problem because the POST data
coming from the HTTP request doesn't even reach my script, although it has
been working all the time on my previous servers. So I guess the problem is
not in my method of getting/parsing the data, but in the process between the
client's request and the script getting it. And PHP scripts get the POST data
fine, argh :(

But thanks a lot for your suggestions, I'll try them as soon as I am done
compiling the perl port and re-installing all my perl modules.. Not that there
is a chance of it working better, since the system's perl works ok for POST
when trying it in the console. But I'm lost so trying anything I haven't
yet...

Thanks again Matt :)

--
Olivier

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message


Re: POST data not available in cgi perl scripts

2003-03-12 Thread IAccounts
 On Wed, Mar 12, 2003 at 12:48:44PM +, Matthew Faircliff wrote:
  Hello,

 Hiya,

 
  Have you tried using libapreq? I find that it is a superior method of transmitting 
  POST data. Find it in /usr/ports/www/p5-libapreq.
  $my_posted_var = $r-parms{'my_var'};
 

 Nope haven't tried it yet, because using CGI.pm was working for me on my other
 servers, I never felt the need for a more clever thing, but I'll give it a try
 for sure, this looks great.

  Also, why not look into Mason (like emb_perl, only better). It handles POST data 
  like a charm.

 I'll have a look at it right now too.

 But anyhow I don't think those will solve the problem because the POST data
 coming from the HTTP request doesn't even reach my script, although it has
 been working all the time on my previous servers. So I guess the problem is
 not in my method of getting/parsing the data, but in the process between the
 client's request and the script getting it. And PHP scripts get the POST data
 fine, argh :(

 But thanks a lot for your suggestions, I'll try them as soon as I am done
 compiling the perl port and re-installing all my perl modules.. Not that there
 is a chance of it working better, since the system's perl works ok for POST
 when trying it in the console. But I'm lost so trying anything I haven't
 yet...


Post the relevent pieces of your form and the script. (including lines
that contain definitions and parsing).

Steve


 Thanks again Matt :)

 --
 Olivier

 To Unsubscribe: send mail to [EMAIL PROTECTED]
 with unsubscribe freebsd-questions in the body of the message



To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message


POST data not available in cgi perl scripts

2003-03-11 Thread Olivier Dony
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 :

FILE post.cgi
#!/usr/bin/perl -w
print Content-type:text/html\n\n;
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
print DATA: [$buffer]br\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 htmlbody;
foreach $key (keys(%FORM)) {
print $key = $FORM{$key}br;
}
#   ^^^ here my output is always empty too

foreach $key (sort(keys %ENV)) {
print $key = $ENV{$key}br\n;
}

print /body/html;
/FILE post.cgi

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message


Re: POST data not available in cgi perl scripts

2003-03-11 Thread Olivier Dony
On Wed, Mar 12, 2003 at 12:21:59AM +0100, Olivier Dony wrote:
 (...)
 Though if I run my script with 'perl -c' in interactive mode and POST
^^^
Sorry here I meant 'perl' in command line to get the CGI.pm interactive mode,
and of course not 'perl -c', which I had used just before to check the syntax.

 something it works ok and the script gets my POST DATA without problem.
 (...)


--
Olivier

To Unsubscribe: send mail to [EMAIL PROTECTED]
with unsubscribe freebsd-questions in the body of the message