You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Andrew Ho <an...@tellme.com> on 2001/02/17 02:33:05 UTC

Apache::Registry, mod_perl interface, and post data

Hello,

I'm writing an Apache::Registry and I can't seem to retrieve POST
information. I usually write handlers rather than Apache::Registry
scripts, so this is a mystery to me. From a sample form:

    <form method="post" action="post.pl">
     <input type="hidden" name="hello" value="world">
    </form>

To this simple Apache::Registry script:

    #!/usr/local/bin/perl
    my $r = Apache->request;
    print "Content-type: text/plain\n\n";
    print "Post = ( ", join(", ", $r->content), " )\n";

Gives me nothing. My second thought was that Apache::Registry was eating
the POST information to feed it to the script via STDIN (for compatibility
with conventional CGI), so I tried this:

    #!/usr/local/bin/perl
    use CGI ();
    my $cgi = new CGI;
    print "Content-type: text/plain\n\n";
    print "CGI = ( ",
        join(", ", map { ($_, $cgi->param($_)) } $cgi->param), " )\n";

The POSTed information has still gone away! Am I on crack?! This should be
the simplest script ever! Just to check, I ran the above script as a CGI
as the target of the same HTML form and it worked fine.

I'm using Perl 5.6.0, mod_perl 1.24_01, and Apache 1.3.14 on Solaris x86,
CGI.pm 2.56. The client I use doesn't seem to make a difference.

Humbly,

Andrew

----------------------------------------------------------------------
Andrew Ho               http://www.tellme.com/       andrew@tellme.com
Engineer                   info@tellme.com          Voice 650-930-9062
Tellme Networks, Inc.       1-800-555-TELL            Fax 650-930-9101
----------------------------------------------------------------------


Re: section woe

Posted by Jie Gao <J....@isu.usyd.edu.au>.
On Sat, 17 Feb 2001, Erdmut Pfeifer wrote:

> On Sat, Feb 17, 2001 at 08:56:40PM +1100, Jie Gao wrote:
> > 
> > %LocationMatch = (
> >   '^/(myscript|cgi-bin)/' => {
> >     'AuthName'          => 'Elephant',
> >     'AuthType'          => 'Animals',
> >     'AuthDBMUserFile'   => '/mydir/userdbm',
> >     'AuthDBMGroupFile'  => '/mydir/groupdbm',
> >     'PerlAuthenHandler' => 'Animals::ElephantCookieHandler->authen',
> >     'PerlSetVar'        => (
> >                              [ 'VirtualServerName' => qw(www.myhouse.org) ],
> >                              [ 'AuthCookieDebug'   => 7 ],
> >                            ),
> 
> syntactically, you need an array reference here, so try using:
> 
>       'PerlSetVar'        => [
>                                [ 'VirtualServerName' => qw(www.myhouse.org) ],
>                                [ 'AuthCookieDebug'   => 7 ],
>                              ],
 
You are right. I totally missed that. Thanks a lot!

But I still don't know what to do with the following:

<Limit GET POST>
require group group1 group2
</Limit>
<Limit PUT>
require group group1
</Limit>

Anybody has any idea?




Jie


Re: section woe

Posted by Erdmut Pfeifer <e....@science-computing.de>.
On Sat, Feb 17, 2001 at 08:56:40PM +1100, Jie Gao wrote:
> Hi All,
> 
> P. 417 of Eagle book has this:
> 
> Directive is repeated mutiple times
>   
>     If a directive is repeated multiple times with different arguments each 
>     time, you can represent it as an array of arrays. This example using 
>     the AddIcon directive shows how:
> 
>     @AddIcon = (
>           [ '/icons/compressed.gif' => qw(.Z .z .gz .tgz .zip) ],
>           [ '/icons/layout.gif'     => qw(.html .shtml .htm .pdf) ],
>     )
> 
> I am testing the limit directives in my <Perl> section:
> 
> %LocationMatch = (
>   '^/(myscript|cgi-bin)/' => {
>     'AuthName'          => 'Elephant',
>     'AuthType'          => 'Animals',
>     'AuthDBMUserFile'   => '/mydir/userdbm',
>     'AuthDBMGroupFile'  => '/mydir/groupdbm',
>     'PerlAuthenHandler' => 'Animals::ElephantCookieHandler->authen',
>     'PerlSetVar'        => (
>                              [ 'VirtualServerName' => qw(www.myhouse.org) ],
>                              [ 'AuthCookieDebug'   => 7 ],
>                            ),

syntactically, you need an array reference here, so try using:

      'PerlSetVar'        => [
                               [ 'VirtualServerName' => qw(www.myhouse.org) ],
                               [ 'AuthCookieDebug'   => 7 ],
                             ],


>     'SetHandler'        => 'perl-script',
>     'Options'           => '+ExecCGI -Indexes',
>     'PerlSetupEnv'      => 'On',
>     'require'           => 'valid-user',
>     'AllowOverride'     => 'None',
>   },
> )
> 

Erdmut


-- 
Erdmut Pfeifer
science+computing gmbh

-- Bugs come in through open windows. Keep Windows shut! --

section woe

Posted by Jie Gao <J....@isu.usyd.edu.au>.
Hi All,

P. 417 of Eagle book has this:

Directive is repeated mutiple times
  
    If a directive is repeated multiple times with different arguments each 
    time, you can represent it as an array of arrays. This example using 
    the AddIcon directive shows how:

    @AddIcon = (
          [ '/icons/compressed.gif' => qw(.Z .z .gz .tgz .zip) ],
          [ '/icons/layout.gif'     => qw(.html .shtml .htm .pdf) ],
    )

I am testing the limit directives in my <Perl> section:

%LocationMatch = (
  '^/(myscript|cgi-bin)/' => {
    'AuthName'          => 'Elephant',
    'AuthType'          => 'Animals',
    'AuthDBMUserFile'   => '/mydir/userdbm',
    'AuthDBMGroupFile'  => '/mydir/groupdbm',
    'PerlAuthenHandler' => 'Animals::ElephantCookieHandler->authen',
    'PerlSetVar'        => (
                             [ 'VirtualServerName' => qw(www.myhouse.org) ],
                             [ 'AuthCookieDebug'   => 7 ],
                           ),
    'SetHandler'        => 'perl-script',
    'Options'           => '+ExecCGI -Indexes',
    'PerlSetupEnv'      => 'On',
    'require'           => 'valid-user',
    'AllowOverride'     => 'None',
  },
)

Apache complains about this:

handle_command (PerlSetVar "VirtualServerName" "www.myhouse.org"): perl_cmd_var: 'VirtualServerName'
= 'learnonline.usyd.edu.au'
OK
ARRAY(0x2fc014) Options (Invalid command 'ARRAY(0x2fc014)', perhaps mis-spelled or defined by a module not
included in the server configuration) Limit=no
[Sat Feb 17 20:51:28 2001] [error] (22)Invalid argument: <Perl>: Invalid command 'ARRAY(0x2fc014)', perhaps
mis-spelled or defined by a module not included in the server configuration
valid-user AllowOverride (Invalid command 'valid-user', perhaps mis-spelled or defined by a module not
included in the server configuration) Limit=no
[Sat Feb 17 20:51:28 2001] [error] (22)Invalid argument: <Perl>: Invalid command 'valid-user', perhaps
mis-spelled or defined by a module not included in the server configuration
On require (Invalid command 'On', perhaps mis-spelled or defined by a module not included in the server
configuration) Limit=no
[Sat Feb 17 20:51:28 2001] [error] (22)Invalid argument: <Perl>: Invalid command 'On', perhaps mis-spelled
or defined by a module not included in the server configuration


Taking out "[ 'AuthCookieDebug'   => 7 ]," makes the error go away, but it's not a solution.

What's worse: how do you define multiple Limit sections like the following?

<Limit GET POST>
require group group1 group2
</Limit>
<Limit PUT>
require group group1
</Limit>

I'm using A1.3.17 mp 1.2.5.

I am at a loss. 8={



Jie


DECLINED: What's going on?

Posted by Jie Gao <J....@isu.usyd.edu.au>.
Hi All,

On p. 68 of the eagle book, the explanation of DECLINED says:

    The handler has decided it doesn't want to handle the request.
    Apache will act as if the subroutine were never called and either
    handle the phase internally or pass the request on to another
    module that has expressed its interest. Even if all registered
    modules return DECLINED for a particular phase, it will still be
    handled by the Apache core, which has default handlers for each
    phase (even if they do nothing).

I have an authz handler at the very beginning of which I set 

    return DECLINED;

but Apache doesn't seem to kick in its default handler (there is
an .htaccess file in the directory concerned).

Can anybody shed light on this?

Thanks,



Jie 


Re: Apache::Registry, mod_perl interface, and post data

Posted by Andrew Ho <an...@tellme.com>.
Hello,

JB>I don't think the problem is with what you posted. I tried your snippets
JB>on two different systems and they worked as expects. What's your config
JB>look like? Do you get the 'Post = ()' output from the Registry script?
JB>Are you running any other software that might interfere?

Thanks for forcing me to check my config and discovering that Someone left
.pl's set to a different handler of their own, devious creation in
UserDirs (this is a dev box) instead of Apache::Registry. Doh!
Mystery solved. Thanks for the jolt.

Humbly,

Andrew

----------------------------------------------------------------------
Andrew Ho               http://www.tellme.com/       andrew@tellme.com
Engineer                   info@tellme.com          Voice 650-930-9062
Tellme Networks, Inc.       1-800-555-TELL            Fax 650-930-9101
----------------------------------------------------------------------


Re: Apache::Registry, mod_perl interface, and post data

Posted by Jeff Beard <je...@cyberxape.com>.
On Fri, 16 Feb 2001, Andrew Ho wrote:

> Hello,
>
> JB>I added a button and push it. It works. ;)
>
> Urgh, I had a button on my actual test page; it just magically disappeared
> when I retyped it in the e-mail.
>

I don't think the problem is with what you posted. I tried your snippets on
two different systems and they worked as expects. What's your config look like?
Do you get the 'Post = ()' output from the Registry script? Are you running any
other software that might interfere?

--Jeff

--
Jeff Beard
_______________________________________
Web:		www.cyberxape.com
Email:		jeff at cyberxape dot com
Earth:		Boulder, CO, USA


Re: Apache::Registry, mod_perl interface, and post data

Posted by Andrew Ho <an...@tellme.com>.
Hello,

JB>I added a button and push it. It works. ;)

Urgh, I had a button on my actual test page; it just magically disappeared
when I retyped it in the e-mail.

FWIW, after debugging it a bit further, I am getting a Content-length of
the appropriate size, too. The Content-type is also correct for a POST; I
sniffed the packets and the request is correct. Just no input. Nothing on
STDIN, either. I'm frankly mystified, wondering if I'm just totally
missing something obvious.

Humbly,

Andrew

----------------------------------------------------------------------
Andrew Ho               http://www.tellme.com/       andrew@tellme.com
Engineer                   info@tellme.com          Voice 650-930-9062
Tellme Networks, Inc.       1-800-555-TELL            Fax 650-930-9101
----------------------------------------------------------------------


Re: Apache::Registry, mod_perl interface, and post data

Posted by Jeff Beard <je...@cyberxape.com>.
On Fri, 16 Feb 2001, Andrew Ho wrote:

>
>     <form method="post" action="post.pl">
>      <input type="hidden" name="hello" value="world">
> 	  </form>

I added a button and push it. It works. ;)

--Jeff

--
Jeff Beard
_____________________________________
Web:		www.cyberxape.com
Email:		jeff at cyberxape dot com
Earth:		Boulder, CO, USA