You are viewing a plain text version of this content. The canonical link for it is here.
Posted to embperl@perl.apache.org by James Lee <ja...@onsight.com> on 2000/10/23 16:23:36 UTC

GET is ok, POST is not working

I am new to embperl and I am having a problem that I can't seem to find
an answer to.  I am hoping someone here can help.

I am trying to post data to an empbperl program.  Using method="get"
works fine, but method="post" fails.

Here is an example.  First the form in a.html:

------------
<html>
<head></head>
<body>
<form method="get" action="/embperl/b.html">
Name: <input type="text" name="name">
<br>
Age: <input type="text" name="age">
<br>
<input type="submit">
</body>
</html>
------------


Now, the embperl file, b.html:

------------
[-
  $name = $fdat{name} || '';
  $age = $fdat{age} || '';
-]
<html>
<head></head>
<body>
<pre>
name = [+$name+]
age  = [+$age+]
</pre>
</body>
</html>
------------


Using method="get" works exactly as I expect.  When I change to
method="post", I get a popup window:
	Netscape: Error
	The document contains no data.

Here is the section from my httpd.conf file turning on embperl:

------------
<Location /embperl>
  SetHandler    perl-script
  PerlHandler   HTML::Embperl
  Options       ExecCGI
</Location>
------------


I would appreciate any help in finding a (simple, I hope) solution
to this problem.

Many thanks in advance,
James

-- 
James Lee     ==  james@onsight.com                           Perl Training
Onsight Inc.  ==  http://www.onsight.com/                  Perl Development
                                                          Internet Training
                                                       Internet Development

Re: GET is ok, POST is not working - FIXED

Posted by James Lee <ja...@onsight.com>.
> Maybe something is wrong with http headers. If you have LWP installed (if
> not you should do it) the try
> 
> POST -e http://localhost/your/url
> name=one&age=two
> 
> This should display the response headers along with the content.

This worked.  So I thought, hmm, let's try lynx.  lynx worked.
Hmm, let's try Netscape on the  Mac.  It worked.  As well as on
Windows.  It was not working with Netscape 4.61 on Linux, so I
upgraded to 4.75, and now it works.

Thanks for all the help, even though the problem was unrelated to
embperl.

James

-- 
James Lee     ==  james@onsight.com                           Perl Training
Onsight Inc.  ==  http://www.onsight.com/                  Perl Development
                                                          Internet Training
                                                       Internet Development

Re: GET is ok, POST is not working

Posted by Gerald Richter <ri...@ecos.de>.
>
> The logs look identical to me, but the post does not display on the
> browser.
>

Maybe something is wrong with http headers. If you have LWP installed (if
not you should do it) the try

POST -e http://localhost/your/url
name=one&age=two

This should display the response headers along with the content.

Gerald


-------------------------------------------------------------
Gerald Richter    ecos electronic communication services gmbh
Internetconnect * Webserver/-design/-datenbanken * Consulting

Post:       Tulpenstrasse 5         D-55276 Dienheim b. Mainz
E-Mail:     richter@ecos.de         Voice:    +49 6133 925151
WWW:        http://www.ecos.de      Fax:      +49 6133 925152
-------------------------------------------------------------



Re: GET is ok, POST is not working

Posted by James Lee <ja...@onsight.com>.
> Are you sure you don't have CGI.pm or something in the middle, eating the
> form data?

I am sure that I don't have CGI.pm or anything else in the middle.  If
I did, wouldn't that affect get as it would post?
 
> Do you have any EMBPERL_OPTIONS set?

No.  The only option I have set is EMBPERL_DEBUG.

I turned DEBUG up high, and with method="get", the following is put
into the log file, and then the browser displays the expected text:


[2869]EVAL> two
[2869]SRC: Line 5: <html>
[2869]SRC: Line 5: <head></head>
[2869]SRC: Line 6: </head>
[2869]SRC: Line 6: <body>
[2869]CMD:  Cmd = 'body'
[2869]SRC: Line 7: <pre>
[2869]SRC: Line 8: [+$name+]
[2869]EVAL< $name
[2869]EVAL> one
[2869]SRC: Line 9: [+$age+]
[2869]EVAL< $age
[2869]EVAL> two
[2869]SRC: Line 10: </pre>
[2869]SRC: Line 11: </body>
[2869]SRC: Line 12: </html>
[2869]PERF: input = /usr/local/apache/htdocs/embperl/b.html
[2869]PERF: Time: 0 ms Evals: 3 Cache Hits: 0 (0%)
[2869]Request finished. Tue Oct 24 03:42:20 2000
. Entry-SVs: 10556 -OBJs: 7 Exit-SVs: 10701 -OBJs: 10




With method="post", the following is in the log file, but the browswer
shows the popup "The document contains no data":

[2885]EVAL> two
[2885]SRC: Line 5: <html>
[2885]SRC: Line 5: <head></head>
[2885]SRC: Line 6: </head>
[2885]SRC: Line 6: <body>
[2885]CMD:  Cmd = 'body'
[2885]SRC: Line 7: <pre>
[2885]SRC: Line 8: [+$name+]
[2885]EVAL< $name
[2885]EVAL> one
[2885]SRC: Line 9: [+$age+]
[2885]EVAL< $age
[2885]EVAL> two
[2885]SRC: Line 10: </pre>
[2885]SRC: Line 11: </body>
[2885]SRC: Line 12: </html>
[2885]PERF: input = /usr/local/apache/htdocs/embperl/b.html
[2885]PERF: Time: 0 ms Evals: 3 Cache Hits: 0 (0%)
[2885]Request finished. Tue Oct 24 03:44:10 2000
. Entry-SVs: 10558 -OBJs: 7 Exit-SVs: 10703 -OBJs: 10


The logs look identical to me, but the post does not display on the
browser.  

As before, all help is greatly appreciated,
James

-- 
James Lee     ==  james@onsight.com                           Perl Training
Onsight Inc.  ==  http://www.onsight.com/                  Perl Development
                                                          Internet Training
                                                       Internet Development

RE: GET is ok, POST is not working

Posted by Ilia Lobsanov <il...@lobsanov.com>.
James,

Are you sure you don't have CGI.pm or something in the middle, eating the
form data?

Do you have any EMBPERL_OPTIONS set?

ilia.


> -----Original Message-----
> From: James Lee [mailto:james@onsight.com]
> Sent: Monday, October 23, 2000 10:24 AM
> To: embperl@perl.apache.org
> Subject: GET is ok, POST is not working
>
>
> I am new to embperl and I am having a problem that I can't seem to find
> an answer to.  I am hoping someone here can help.
>
> I am trying to post data to an empbperl program.  Using method="get"
> works fine, but method="post" fails.
>
> Here is an example.  First the form in a.html:
>
> ------------
> <html>
> <head></head>
> <body>
> <form method="get" action="/embperl/b.html">
> Name: <input type="text" name="name">
> <br>
> Age: <input type="text" name="age">
> <br>
> <input type="submit">
> </body>
> </html>
> ------------
>
>
> Now, the embperl file, b.html:
>
> ------------
> [-
>   $name = $fdat{name} || '';
>   $age = $fdat{age} || '';
> -]
> <html>
> <head></head>
> <body>
> <pre>
> name = [+$name+]
> age  = [+$age+]
> </pre>
> </body>
> </html>
> ------------
>
>
> Using method="get" works exactly as I expect.  When I change to
> method="post", I get a popup window:
> 	Netscape: Error
> 	The document contains no data.
>
> Here is the section from my httpd.conf file turning on embperl:
>
> ------------
> <Location /embperl>
>   SetHandler    perl-script
>   PerlHandler   HTML::Embperl
>   Options       ExecCGI
> </Location>
> ------------
>
>
> I would appreciate any help in finding a (simple, I hope) solution
> to this problem.
>
> Many thanks in advance,
> James
>
> --
> James Lee     ==  james@onsight.com
> Perl Training
> Onsight Inc.  ==  http://www.onsight.com/                  Perl
> Development
>
> Internet Training
>                                                        Internet
> Development
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: embperl-unsubscribe@perl.apache.org
> For additional commands, e-mail: embperl-help@perl.apache.org
>
>